New answers tagged

0

In your view, make sure your exposed filter is not the gallery type field itself, but 'Has taxonomy term' filter with the taxonomy group vocabulary selected and then set the exposed grouped filters the same way.


0

I tested it on an other drupal instance and there it was working fine. So I deleted and reinstalling my drupal environment and know it is also working fine


1

This patch is related to this issue https://www.drupal.org/files/issues/2019-08-01/2842525-56.patch. See the section core/modules/views/src/ViewExecutable.php especially, the FormBuilder part is already committed but the rest is waiting.


0

Without trying to recreate your grouped search, I think it might be a logic error where your search will show all the results for Label <Photo> is one of "Photo" taxonomy term AND Label <Video> is one of "Video" taxonomy term. What happens if you combine both of them into one item, where Label <Type> is one of "Photo" OR "Video" taxonomy ...


0

This is a known issue with CKEditor. In your case, the ampersand character & is being escaped as &amp; which is causing the HTML entity for your apostrophe to appear as &amp;#039;. The entity for the ampersand is well-formed, so the ampersand appears in your rendered output. But this causes the entity for the apostrophe to be malformed, so it ...


0

For any latecomers to this question, there's a module that does just this Views Row Insert It has it's limitations when you start to push it, but it would do just as OP requests with very minimal effort and no hooks needed.


0

There are two questions asked in the OP: What is the reason for not being able to choose the widget type for an exposed filter? Space: It seems that Views decide that for you, in the module's wisdom. I find this is a good enough argument, the rest can be handled as wished by a custom filter. // Exposed filter: use a select box to save space. Source: ...


2

This is a display which can be embedded via views_embed_view() or drupal_view() of Twig Tweak. You can embed other display types, too, for example Page or Block, but the first one generates a route and the second one a block derivate you see when adding blocks to the block layout. So Embed is basically a display type which does nothing until you embed it in ...


0

Tip: look for other javascript errors happening on the page. If a JS error happens before the the assignment of drupalSettings, it will not be initiated.


0

If you want to display the structure of the view as JSON API output you need to get the UUID of the view and then pass it to the json api For example as given below. http://yoursite/jsonapi/view/view/889120bb-98f2-43be-8ca3-d93d1cd15590 To get the UUID of the view you need to go http://yoursite/jsonapi and scroll to the View portion of the output and ...


1

Your contextual filter will be expecting the term ID rather than the term name. You'll need remove that contextual filter and then add a relationship to the taxonomy which will then allow you to add a contextual filter for the taxonomy term name rather than the term ID


2

You might want to look at the Views Data Export contrib module: https://www.drupal.org/project/views_data_export This module exposes a drush command that can execute the view and save its results to a file. drush views-data-export [view-name] [display-id] [output-file] Since you can call this command via drush from the shell, you should also be able to ...


0

The Views Sort By Options Weight module allows to do this but for Drupal 8.


0

oh dear lord.. Didn't dawn on me to make the field visible so I could see it. The answer is "on"


0

Depending on your view filters, you might need the patch at https://www.drupal.org/node/1766338


1

When you edit a view, on the top right corner there is an Edit view name/description button.


0

Download Views Distinct Module and follow the following steps. Click on the filed title -> under VIEWS DISTINCT SETTINGS select filter repeats from Filter/Aggregate this field dropdown


1

I can see two possible solutions to this problem: Solution 1: Better Exposed Filters Install the Better Exposed Filters module. There are over 31,227 sites using it at the moment. Don't let the fact that it is in alpha hold you back unless your organization has a policy preventing you from using alpha releases. Solution 2: Custom Code If you cannot use ...


1

In your custom theme check if there is a templates/views-view.html.twig file If not you you can get a copy from core/themes/stable/templates/views/views-view.html.twig and modify the position of header section to be below exposed the content should look similar to the following after your change ... {{ exposed }} {% if header %} <header> {{ ...


0

I ended up achieving this. The exposed filter was defaulting to a textbox instead of a select list, so I used hook_form_alter to change it to a select list, and since I was already altering the form I used that time to use EntityFieldQuery to pull in only the 'options' available to the user (based on the assigned_user entityreference field on the district ...


1

Change owner is an action implemented by the Views Bulk Operations module, while Change the author of content is an action implemented by the Node module. (See views_bulk_operations_change_owner_action_info() and node_action_info().) The VBO module implements that action for any entity for which that action makes sense. (In other words, if the entity doesn'...


0

Thanks @4k4. Your comment started me poking around in ajax_view.js which ultimately led me to the cause. My issue was that my display ids had multiple underscores in a row, e.g. listing__large. If I update the display id to large_listing everything works fine. I guess multiple underscores in a row aren't supported in the display ids, and I'm guessing also ...


0

Get to the Exposed filter form section of the ADVANCED box to set Exposed form in block: to "Yes" and doing so will make the filter be displayed in the views page (if you had that in your setting). In D8, this setting will make the form avialble in the block but not on the page. On D7 the filter will show up in both page and block but in both instance the ...


0

A database view is probably akin to a table view. Yes so in views, which is now a module in core Drupal, when you create a view I think it defaults to a content view. This works with node content as defined in content types and other entities AFAICT. These also have display modes that are defined in your content type or entity. If content view is selected ...


0

After some test I have found that a module was changing filter form states, and then the filter fields were wrong when the query were constructed. I fix that and now it works good.


2

If the district is a term, entity reference, or a list field value, then you should be able to do this. Otherwise, You'll need to do something more involved (and honestly, at that point, you're probably better off just restructuring that data to work with views. As far as only exposing options that will provide valid results, I'd recommend taking a look at ...


0

I applied this patch https://www.drupal.org/files/issues/2019-07-31/facets-3070461-3-Facet-links-break-in-modal_0.patch and issue resolved. Hope this will be helpful for others.


0

A simple solution to this would be to create a new view, with a block display, and add a contextual filter to get the current node ID from the url. Then select a field you would like and add it to the view, for example; "Header". Once you've done that then save. Visit the "Blocks" admin page and add the block to the "Header" region of your page. Your theme ...


0

You can create a custom field formatter plugin for the daterange field type and you can use it at other places on the website too.


0

You can also use a module instead of (or instead of only) core views: https://www.drupal.org/project/reverse_entity_reference Reverse Entity Reference adds a computed reverse reference field to all referenced entities.


3

Depends if you need OR or AND clause : $view->setArguments(array('23,46')); $view->setArguments(array('23+46')); One string for each argument.


0

Solved. The problem seems to be an incompatibility with Better Exposed Filters module. Thanks!


0

Bah, nevermind -- I realized that I can just remove the view from the config table in the db. Then all updates are free to proceed. Thanks!


0

General approach: Use the Rules module (which does not yet have a stable release for Drupal 8, but does have the capability in its current state to implement the recipe below) to detect the content is flagged, then do a Rules action which will result in those fields being hidden. Here is one specific example, but there are many ways, and likely simpler ...


0

I ran into this just today. Turns out you shouldn't set data_table in the entity type annotation if translatable is FALSE. Otherwise views associates all of the fields with the data_table, but data_table is never associated with base_table due to translations being disabled.


0

Are you sure that image style still exists? Views doesn't like when you delete/change image styles that it is already using. A remedy might be to delete that field from your view, and reset it (with the confirmed good image style?) Maybe your image style was formed improperly? (Are your view blocks restricted to not show on the home page (block admin?)


1

It seems that there is a popular module to solve this problem. It can be achieved using a module called Views Bulk Operation, it also has excellent documentation.


0

I had the same issue when using a custom hook_ENTITY_TYPE_access ... just putting an example here to save people time: /** * Implements hook_views_post_execute(). */ function MODULE_views_post_execute(ViewExecutable $view) { if ($view->id() == 'view_name') { $result = $view->result; $account = $view->getUser(); $user = \Drupal::...


0

I got this working: gotchas: 1. Had to load ajax_view.js, added this code snippet to theme file, check your view source to make sure ajax_view.js is loaded. use \Drupal\views\ViewExecutable; function customthemename_views_pre_render(ViewExecutable $view) { if (isset($view) && ($view->storage->id() == 'community_plan_update_news_feed')) { ...


0

You can show the relevant search term in Text area when you add it to the Header option in Views. When you tick the Use replacement tokens from the first row option you will see the Replacement patterns tokens available, and below that global replacement tokens. You can use something like: <div class="messages messages--status">Your search of {{ ...


0

There are two parts to this question: getting the Contextual filtering to reduce the results to only the term IDs you specify in the URL, and using Aggregation for counting and sorting the results according to that count. Contextual filter for Taxonomy term ID Create your Views list of nodes with the Taxonomy reference field showing the tags, and ...


0

Mostly yes, by adding relationships to a view. The drawback is that is not done automatically: you manually have to add all entities/fields that possibly can refenrence a media entity. Create a view showing media entities. Then add the related tables and filter criterias "related/foreign field referencing media -- is not empty" I'd not recommend the "File ...


0

After further search, I have found Views Aggregator module to do exactly what I need to do. I am willing to accept @Stef Van Looveren answer especially where i prefer not to have to add a new module to my site but for some reason isn't working for me, unless somebody can help fix the above provided code.


0

You can construct the Exposed Year filter yourself using the Grouped filters option: Add your Date field Filter and Expose it Select Grouped filters under Filter type to expose Tick Allow multiple selections Select Radios under Widget type Adjust the Label and Description if you need to In the items table change all Operators to Is between and configure ...


-1

function yourmodule_name_form_alter(&$form,&$form_state,$form_id){ if($form_id == 'views_exposed_form'){ $form['field_width_value']['#default_value'] = 'whatever you want'; unset($form['field_width_value']['#options']['All']); } }


-4

You can user the Views PHP module You add your php logic to the field and manipulate the view field results as you wish. If you really need to use a hook in your custom module you can use the custom_module_views_pre_view($view, $display_id, array &$args) hook


0

The hook_views_pre_render() works. function my_misc_views_pre_render(&$view) { if($view->name == 'classrooms_map') { $view->style_plugin->options['map'] = ($view->exposed_data['type'] == 'All') ? 'all' : $view->exposed_data['type']; } }


0

There are probably many different ways of doing it. One possibility is the Calendar Tooltips module. Another is using Colorbox module to control the popup, you construct the Views output yourself so that the Colorbox library displays it as a popup: Does Calendar Popup Module exist in D7?, using-colorbox-display-event-details-popup


1

When rewriting a field into a custom link you have to make sure that the tokens used for the link text aren't formatted as links, because links can't be nested one into the other. Edit the field settings for the fields corresponding to {{ field_tool_manufacturer }} and {{ title }} and make sure their Formatter option is set to Plain text, or that the ...


Top 50 recent answers are included