texts: How can I let a user select my Drupal Commerce product to either be shipped or downloaded?

texts:
I am using the Drupal Commerce module. I want to download the digital file. I am using the Commerce License and Commerce File modules.

But now I need to add an option to let the user select between Shippable or Download. If the user selects Shippable, the product will be shipped, while if the user selects Download, the user will be able to download the file.

I want to do it like in the product page:

If the user selects Shippable, the user doesn't have a FILES tab in the User profile page.
If the user selects Download, the user has a FILES tab in the User profile page.

How can I implement this using Drupal Commerce?.

Any suggestions?


texts: Add a remove button to a custom unlimited value field?

texts:
I'm working on a custom compound field that includes a text value and an entity reference id. The field will contain multiple values, so the widget needs to provide "add new value" functionality, and a way to remove values already added (i.e. a "remove" button).

Following the (older) thread here: https://drupal.org/node/1143880, it seems that "add new value" is provided automatically, but not "remove" existing values? Is that still the case?

The thread above also links to a sandbox project here: https://drupal.org/sandbox/daggerhart/1363702. I tried this code, and it does seem to work, although the formatting is a little different.

What's the current best practice for adding a "remove" button to an unlimited value field widget?

Edit: here is a link to a feature request for this functionality in D8: https://drupal.org/node/1038316


texts: Replicating an existing table-based form as PDF views output?

texts:
The Drupal 6 project I'm working on involves a custom content type with a bunch of different elements. I'm needing to replicate an existing form -- see screenshot.

Ultimately, I need to take the data stored in the CCK fields attached to this content type, and rebuild them as a table as per the screenshot. It then needs to be savable as a PDF.

It seems like there are two ways of doing PDF content of the nature I'm wanting:

Views PDF -- cumbersome as heck to configure; requires manually positioning each field.
Print -- I can't figure out how to directly access the CCK field variables through its $print object; consequently, I can't rebuild this as a table.

How would one go about taking a lot of CCK fields, formatting them as a table, then making that PDF-able?

Thanks.

Edit: To clarify, I have each row of, say, the FAC table stored as a row in the content type, through a compound/multifield module called "Flexifield". Data isn't stored as per the table; it's stored as a label ("level"), a decimal number and a boolean (above or below grade?). Another boolean toggles between Imperial and Metric for the entire sheet. The columns are generated by converting the number stored to either Imperial or Metric, depending on which the stored measurement is set as. Consequently, I'll ultimately need a way to tweak and restructure the data using PHP. This is why I can't, for instance, just tell the fields to display as a table.


texts: Updating Drupal modules via git on remote server

texts:
Here is my Drupal workflow for updating modules.

I update modules on my local dev and test.
Run update via drush if needed.
Commit and push to github.
Pull these new updates from Github on remote server to live site.
run update via drush.

However, I was thinking of making a "modules-update" branch, pushing to that from local dev, pulling that branch to my live site and merge with my master branch later if all went well. If all does not go well for some reason on the live site, then I could simply pull from my master branch that had the older versions and do a restore of the DB from the backup and restore module if need be.

So my questions is, I am looking for feedback if this seems like a sound practice or are there better ways to do this? I am fairly new to Git so I am guessing there might perhaps be a better way than this.


texts: how to get backtrace information for php errors in drush

texts:
I want to get backtrace information for php errors in drush.

Tried out the following patch - http://drupal.org/node/1158322#comment-6249880. Its shows the backtrace info as message(while using browser), but I'm not getting these messages in drush


texts:
Am using content import module in drupal 8 to import nodes. For test i have defined like below

It works fine when smaller body content. But when the body is too large. Then the import is undone with no fail message.

Test Case:

I have unchecked the below in the configuration,

I turned on the source mode in ck editor and pasted large body html content. And saved the changes it works.

Content Type: Basic Page

Sample Body Content(Formatted):

Total lines will be around 500.

Is it possible to import the file attachment too?


texts: Media & Media Entity Browser upload problems

texts:
I am using the following:

Drupal 8.6
Media
Media Library
Media Entity Browser 8.x-2.0-alpha1
Inline Entity Form 8.x-1.0-rc1
Entity Browser 8.x-2.1
Entity Embed 8.x-1.0-beta2

Mainly to upload documents.
I have updated the media type: file [/admin/structure/media/manage/file/fields] to include an additional text area 'abstract'.

I have two problems.

1 In a WYSIWYG CKEditor field:
I have added the default Media Entity Browser. This works fine for added existing media, but upload does not work.
On the upload tab, I can upload a file, which shows as:
icon - filename - remove button.

Click on the select media button and I get the following error: 1 error has been found: Choose a file, with a link to:
/entity-browser/iframe/media_entity_browser?uuid=7a535c60a92fbe357951d3bb7440bc97bf8d9554&original_path=/entity-embed/dialog/full_html/media_entity_embed#edit-widget

which does nothing if clicked.

If I look at /admin/content/files, I can see the file I have just uploaded. But there is no corresponding media item: /admin/content/media

Any ideas how to get the media browser file upload to work?

2. On the content type
I have and entity reference field, set to media and uses the widget: media library.
I can add existing and upload new files no problem, BUT, when I upload a new file, I only have the option to edit the file name, not add the custom abstract textarea.
I have the abstract textarea form element added to the media item in /admin/structure/media/manage/file/form-display which shows if you add media items by add media -> file /media/add/file

thank you for your help.


texts:
I want to add a custom tab after "Edit" but can't figure out how to do so. I added a mymodule.links.task.yml file

entity.node.import_form:
  route_name: entity.node.import_form
  base_route: entity.node.canonical
  title: Import JSON from file

But I don't understand what to do next. The node form just errors out with:

  Symfony\Component\Routing\Exception\RouteNotFoundException:
  Route "entity.node.import_form" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName()
  (line 128 of /var/www/sites/datacenter.com/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php).


texts: Proper way of removing/hiding unwanted elements?

texts:
There are many times where in drupal I'm styling a theme and if I don't need some element I cannot remove in settings I just hide it with css(display:none, or similar).
Is it considered a bad practice to do this and should I always use hooks or some over methods?


texts: commerce feeds product import not showing up

texts:
I imported a file with 5 fields UPC-> SKU(Unique), Product Description -> Title, Unit Price -> Price Amount and 2 custom fields for wood type and knife number the import process says it created 21 products and I can find these products through phpmyadmin in various places including commerce_product, commerce_product_revision.

There are also a number of entries of type commerce_product in the field_revision_field_product_category table where as the types of my already created content are node in the same table. They all have a price of 0  but are not showing up in the product listing.

I'm using commerce kickstart 2.0, commerce feeds 1.3, feeds 2.0 alpha 7 and have feeds tamper 1.0 beta 4.
I have run cron and flushed all caches.

I tried this in a fresh install of Commerce Kickstart but the products are still not showing up in the view products screen.

I also created a barebones Drupal 7 install with commerce and feeds/commerce feeds and other required modules and the products seem to be created just fine.


texts: Module for Integrating jQuery UI Multiselect Widget

texts: I am using the jQuery multiselect widget on another non-Drupal project and I would love to be able to use it with CCK in Drupal 7. I have found this module for CCK multiselect but it is not exactly what I want. I realize I could try to write something, but I was curious if anyone has used the above with Drupal before or if there is a module out there I'm missing.


texts: How do I apply a discount for the second and successive items only if the quantity for those items is higher than 1?

texts:
Using Commerce Discount and Commerce Discount Extra modules there is no problem to set discount rule conditions for product type and quantity. This way I can set up 20% off discount that is applied for a cart line item when this line item has specific product type and quantity more than one. 20% off discount is then calculated for this line item and multiplied by quantity.
However, my need is to apply such discount not to each item from line item quantity. I simply want to exclude applying discount for one (first one) on the basis: 0,2*(n-1)*X where n is qty and X is product base price.
The problem is that line item discount type in Commerce Discount module is calculating before quantity calculation (only for qty of 1) and proper price component is added to line item price.
The solution I've tried was to divide calculated discount (0.2*X/n) but the result calculated for quatity 3 or 6 or 9 is inaccurate (wrong, decimal number).
Is there a hook or other solution that can allow me to "return" the part of discount that should not be applied, or am I simply missing something and there is a more natural way to achieve what I described (for example,  the order discount rule)?


texts:
In node edit form, I am not able to see any other fields other than body field. Though the field values are displayed in the node view page.

For debugging, I tried to print the form value in form alter. To my surprise, all the fields are displayed in the form with #access true. I even checked the DOM if I have hided the fields by mistake, but there were no field markup in the DOM either. I checked all this as the drupal super admin.

The only major change I did in recent time was enabling https for the site. Has anyone faced something similar? Can anyone suggest on how to debug this issue?


texts: How to track what has (or hasn't) been "featurized" in the UI?

texts:
On a sufficiently large or complex site that uses Features to export or manage configuration, it seems easy to encounter a scenario where an administrative user can inadvertently change a variable that has been "featurized" and end up having that variable reverted when features get reverted at the next code update.

The person making the change needs to remember (and to have access) to either check the Feature UI or grep the features code. I'm curious how other big sites might be handling this problem. Is there any trick to maybe highlight variables that have been featurized when they get exposed in the UI?


texts: Replace page number with image field value in pager

texts:
Possible Duplicate:
  Use a content type’s field as a pager item in Views

I created a view of nodes (it shows full node, not its fields) and have a full pager.

Every node has image field and I would like to replace page numbers in pager by these images. It would looks like a previews. Now I have "prev 1 2 3 next" and would like to have "prev image#1 image#2 image3 next".

Is it possible to use field value of node instead of number in pager?


texts: Enable/ disable „Display author and date information“ per node?

texts:
It is passible to enable or disable the „Display author and date information“ for each node depending on the content of a field?

The base:

Drupal 8.3.0 (rc2)
field „Where to publish“

Case 1: field „Where to publish“ = „public“
Case 2: field „Where to publish“ = „internally“

-> in Case 1: disable „Display author and date information“

-> in Case 2: enable „Display author and date information“

How can this be realized? Is that possible?
Or should I use two different content types?

First part runs:

function kanu_preprocess_node(&$variables) {
if ($variables['node']->getType() != 'test') {
    return;
  }
$field = $variables['node']->field_where_to_publish;
}

Completed it returns an unexpected error:

function kanu_preprocess_node(&$variables) {
  if ($variables['node']->getType() != 'test') {
      return;
  }
  $field = $variables['node']->field_where_to_publish;

  if (!field->isEmpty() && $field->entity->label() == 'public') {
     $variables['display_submitted'] = FALSE;
  }
}


texts: How can I attach a phone number field to the user account and optionally validate it via SMS?

texts:
On my site, after registering their account, I want users to optionally be able to go to their account page, input a phone number, and then verify that number by SMS.  When they verify the phone number, I want to award a special role (ideally via Rules).

It seems like there are several modules that might be able to do this:

Two-factor authentication-- this supports SMS with the TFA Basic plugins, but I don't want to use SMS for authentication, just once to verify the number.
Twilio-- this module has user phone number verification, but it does it in a special database table (not a Drupal field) and does not have a rules event for "when a number is verified."
SMS Framework-- this module contains a submodule ("SMS Framework Users") for phone number verification, but it only works on registration; there is no option to register a number later (and in my case, I do not want to collect numbers on registration; I want to collect numbers later optionally).

Related questions:

Verification code when adding new number
Cell phone validation using SMS message


texts: How to dynamically change the variables of a view?

texts:
I create a view (eg Generic) which defaults to a mini pager 10 items.

When I visualize this view, I would like to dynamically change the number of items in the passing 3.

How? What hook to use?


texts: Change Profile2 Profile Type after registration

texts:
I am trying to get Profile2 module to work with Simple_FB_Connect but the flow of Simple_FB_Connect requires that the user signs up first and then i need to be able to set the Profile2 user type afterwards.

After returning from FB i want the user to be able to click "Consumer" for example and their Profile gets set. Something like this...

function MYMODULE_set_user_type() {
  global $user;
  //dsm($user);
  $uid = $user->uid;

  $type = $_GET['type'];
  if (isset($type)) {
    profile2_load_by_user($uid, $type_name = 'main');
    // Unsure what to put here.
    profile2_save($profile);
  }
}


texts: Can Entity Translate work on the node body?

texts:
Problem

I'm using Entity Translate for the multi-lingual parts of my site, this allows me to use the language switcher. (I've enabled it for content, and then on the content type I've enabled field translation).

However the node body is not translatable.

Do I need to create a field and use that as the body, or have I set-up entity translation badly?


texts: In a group content add form, the og_group_ref is empty, except for the "_none" value

texts:
This is only for non admin members. Administrators have the field populated, but logging in as anyone that isn't in that role produces an empty field, except for the "_none" value.

I've tried adding the value manually, like this:

if(!isset($form['og_group_ref'][LANGUAGE_NONE][0]['default']['#options']['MyGroup'][$gid])){
  $form['og_group_ref'][LANGUAGE_NONE][0]['default']['#options']['MyGroup'][$gid] = 'current MyGroup';
}

This adds the item, but I get an error about an illegal option, so it's not the solution.

Again, the field loads all groups for the admin members, but not for non admins. Is there a special permission that needs to be set?


texts: Can behat log in as an administrator for testing while using LDAP?

texts:
I'm using the Behat Drupal Extension. When I try to run a behat test on a sandbox server, I see the following. I see that a temporary admin user is being create but it can't seem to log in. How might I remedy this so that behat can login?

$ behat

Feature: First   Playing with features and exploring

  @api   Scenario: Run cron
# features/first.feature:6
    Given I am logged in as a user with the "administrator" role # Drupal\DrupalExtension\Context\DrupalContext::assertAuthenticatedByRole()
      Failed to log in as user 'ss5vWjZY' with role 'administrator' (Exception)
    When I run cron                                              # Drupal\DrupalExtension\Context\DrupalContext::assertCron()
    And am on "admin/reports/dblog"                              # Drupal\DrupalExtension\Context\MinkContext::visit()
    Then I should see the link "Cron run completed"              # Drupal\DrupalExtension\Context\MinkContext::assertLinkVisible()

I've changed my LDAP configuration back to mixed mode:

And only admins are allowed to create a new account


texts: How to delete all nodes referencing a given one?

texts:
I'm working on a catalog based on Drupal Commerce. I have a product display content type referencing product entities. I'm thinking about the ways to make life of a content manager easier.

I made a rule which fires when product is created and creates a corresponding Product display. But I can't figure out the best way to delete a product display nodes when the product is deleted.

Till now I've tried VBO, but seems in Drupal 7 rules2 lacks the ability to run VBO actions.

I guess a quick and dirty solution is to write a module for this task, but I'm looking for something more elegant. Any ideas?


texts: Term reference is not available as a contextual filter for a View. Why not?

texts:
I have a commerce product of type Album. On this content type is a taxonomy term reference. This term is from the vocabulary 'Our Artist'. In other words, every album gets tagged w/ the artist name that comes from the 'Our Artists' vocabulary.

I'm trying to create a view that groups together all of an artist albums. I want to use this taxonomy term as a contextual filter. But it is not showing up as an option in the contextual filters list. Can someone explain why?


texts:
I've been asked to create an intranet at work and thought I'd look at Drupal to get this done. What they want to have is a few blogs, a calendar, a forum as well as a link to all of the documentation that staff are required to be able to access to do their jobs, such as a phone list (in .xls format) and a ton of .pdf files that contain policies and procedures.

I have D7 installed on a 2008R2 server, the same server that contains all of the data. This server doesn't face the internet, so security doesn't have to be too deep.

Anyway, how would I create my site in Drupal so that I can point to the directories on the file server (which everyone can access to read)? I'm ok with a directory listing, it doesn't have to be fancy.

I had explored creating a directory inside of my site then having the files sync between the data drive and the www data store. I looked into having the site tie into our AD infrastructure but it's going to be setup so only a few can add to it and everyone else can read. The forums will be for certain staff (5 or so) to be able to bat around ideas.


texts: How can I render an image_field from within hook_block_view?

texts:
I want to contain my custom content type's image field (cck) within a block. I define the block within hook_block_view:

function foxyidx_block_view($delta)
{
    $t = get_t();
    if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
        $node = node_load(arg(1));
    }
    switch($delta)
    {
        case 'foxyidx_images':
            $block['subject'] = '';
            $render_out = drupal_render($node->field_image);
            $block['content'] = <<<HTML
                {$render_out}
HTML;
            break;

If I were to render the image_field in a template I would use

print drupal_render($content['image_field']);

However, in the hook_block_view function I assume I need to use another function. Any ideas?


texts: Send reminder to referenced users day before event date in cck date field

texts:
I have a node type called event.

An event has a "Event Date" date field, and a "Staff" user reference field.

I need to send a reminder emails to all referenced users, 1 day before the event date to remind them they are working.

I'm getting lost in Rules trying to work out what actions I need it to react on, and how to get the users emails to send the message to.

My problem is pretty similar to "How to send notification for an event for users that have signed up with the list of events for that month?" which was asked 3 years ago and didn't get a reply.

Can someone who is an expert with rules help me out?

UPDATE:

I have it working for one user reference field now. Added relationship "User: Duty Manager (field_duty_manager) - reverse" and contextual filter "(field_duty_manager) Content: Nid" with "Hide view" when filter is not available. I can type in "55" into the perview, and it only lists the Duty Manager, perfect.

My next struggle is to get this to work for the mulitple user reference fields. Am i going to have to clone the rules for each individual field?


texts: Is it possible to have body trimmed to lets say 150 chars with read more link, and when you click read more, full body field opens in colorbox ?


texts: Add textfield to system branding block form to specify link URL

texts:
I would like to alter the branding block to add a textfield in the block form to specify the URL it should redirect to. The URL is currently fixed to <front> in the Twig template.

What I've done so far is to add the text field with hook_form_alter. I'm saving the value using $form['entity_builders'] and $block->setThirdPartySetting. This works.

I want to retrieve this value in hook_preprocess_block__system_branding_block(&$variables) but $variables does not contain the block entity. How can I get the block in this preprocess function so that I can load my added value with $block->getThirdPartySetting?


texts: Permissions on non Drupal generated content

texts:
Relative newcomer to Drupal 7 and I'm still coming to terms with some of the naming conventions used, so please forgive me if I bork the language up front.

The problem I am trying to solve:

I'm going to build a community / logged in user content website

I'm rebuilding from another existing site, but only manually copying content over (the current site is not built in Drupal).

I have HTML5 microsites in the current environment and I plan to copy them across to the new, but I want to ensure that there are user permissions applied to them so that only logged in users can view the pages.

How do I solve this problem? Is there a module that can "import" content? Or some code I can embed in the pages?

Thanks!


texts: Style views row layout debending on result count

texts:
How to style views row layout debending on result count?

If views has 4 results then items should be placed on two rows and two columns:
| |
| |

And when views has more than 4 items - for example 6 then:
| | |
| | |


texts: How do I show username & email address of currently logged in user on a page he is viewing?

texts: I want the logged in user to see his name and email address in the text of a paragraph on a given page, how to I extract that information from the currently logged in users account, and show it in the body of the page?


texts: How can I send a Privatemsg using Rules and have the name of the site as the sender?

texts:
I am using the Privatemsg and Rules module and I am trying to set up an automatically generated welcome message to new members registering on the site. This message will go into the new member's inbox.

I do not see a token that would allow the site's name to be the sender. All I see is the token for the logged in user. As expected, this doesn't trigger the message.

I have toyed with the [account] token. So when John creates an account, the message comes from John himself. This would be acceptable but it isn't consistent: Sometimes it works, sometimes it doesn't.

I know some tokens exist that are not always displayed. Does anyone have the name of the mysterious token? Or the magic to get this to work?


texts:
I am brand new working with Drupal 7 and I am working on a professional project and I would like some help to achieve some requirements.

We have some content types like associations. Authenticated users may add new associations after administrators validation.
What is the best approach to display custom forms that are able to insert data as content types?
This forms must appear in a non administrative environment, so, I don't know if there is something to export Drupal add/content form and display it to the authenticated user.

I will appreciate any help.
Cheers!


texts:
I've just installed the Google Custom Search Module.

I've activated the module and inserted the API. The search is is till not working.

Something I'm missing?

Note: I've realized I need the paid version. is there a free Google Custom Search, free option?


texts:
I have a view that shows a thumbnail of the node and the teaser of the node for all nodes of a certain content type. What I want to do is to only show nodes tagged with a certain word, using the url

My website taxonomy page has this format /category/tags/beauty

How can I do this?


texts: Building a content type "news headlines." I want the title to be the headline and I want that headline to link to a outside URL that has the full story. This node-summary could then appear on the home page and in a view and not link to the node but to the outside story. I can make a link that does that but cannot figure out how to make the title do this.


texts:
I have code which checks if field exists, but I try to change it to check if field has value (content) or not.

In views I have one field to show all content (Rewrite results). So all fields are loaded always. Thats why I need code which checks does field have content or not.

This is what I got now, but it adds "has_no_field" to all - no matter if field_image has content or not.

function theme_preprocess_views_view_unformatted(&$vars) {
  $view = $vars['view'];
  $rows = $vars['rows'];

foreach ($vars['view']->result as $id => $row) {

    if (isset($row->field_image['und'][0]['value']) == 1) {
      $vars['classes_array'][$id] = 'has_field';
    }
    else {
      $vars['classes_array'][$id] = 'has_no_field';
    }
  }
}


texts: How to check how many times a user has logged in?

texts: I want to know how many times a user has logged in until a given date in Drupal 7. Is this possible?


texts: Problems with Views Load More module loading via AJAX

texts:
I tried to add the Views Load More module to my semantic view but it doesn't load all of the view fields (e.g. image, etc.) when I use it with ajax. Can someone give me a hint why?

Here you can see the view:

http://www.mustxhave.com/testing

The site runs Drupal 7.43 and Views Load More v1.5. The view output is standard, no .tpl theming for this view.


texts: how to effectively hide a field (with title) on a form

texts:
Possible Duplicate:
  specify $form elements to be excluded from display?

I would like to hide a field on a form using hook_form_ID_alter. The form is owned by another module. This field cannot be unset because it contains a value.

Using CSS {display: none} for the standard field class is not good because the field should be hidden only in specific conditions (which must be determined using php).

In hook_form_ID_alter, I could add an #attribute to the field with a class value e.g. hideme and then use CSS to hide this class. But it will leave the field title (tried).

The field has #prefix set to <div class='some_class'> (in this particular case). This prefix precedes the field as well as the title when displayed in a browser. So I could analyze the prefix with regular expression and add a hideme class there. But I am not 100% sure what the #prefix will contain, so the regexp could be complex.

Perhaps there is a better way to hide a field with title on a form?


texts: What is the best way to extend \Drupal\node\Entity\Node?

texts:
When dealing with nodes on Drupal 8, we usually receive an instance from \Drupal\node\Entity\Node, that is great in many aspects, but i'm not sure on how to extend it so that I can use classes that represent something in my own domain, rather that generically using Node. I can make this here:

class Video extends \Drupal\node\Entity\Node {}

Ok. But to have Video::load() and that sort of things, i'm seeing that I need to probably also extend NodeStorage, because everything returns a Node class and type changing seems to be not so easy in PHP from what i'm seeing until now. I'm not sure if this is really the way to go.

I really like to work extending Node(I used to extend EntityDrupalWrapper on D7), as it becomes easier for newcomers to the project and to have stuff like $Video->getFileUrl()

Any ideas?


texts: Webform Confirmation Page URL alias tokens

texts:
From several things I have read, it seems like I have this correct, but it doesn't seem to be working. On my form settings page under "Confirmation page URL alias", I have:

/quote/thank-you?loc=[webform_submission:values:location:value]

When I submit the form, I'm taken to:

/quote/thank-you%3Floc%3D%5Bwebform_submission%3Avalues%3Alocationl%3Avalue%5D?token

What am I doing wrong? Why is it not replacing that value? Does the fact that my form is paged have anything to do with it? The element I'm looking for ("location") is on a page called "provider". Does that need to be represented in my token somehow?

Thanks!


texts: Special non-utf-8 characters appearing in feed imported from a windows based system?

texts:
I have a custom feed importer that import content from an external feed. The import happens on cron and everything is working fine except that the content comes with special non-utf-8 characters. I looked on stackoverflow and there are a few suggestions about how to do this in code, I tried couple and it has not worked for me yet. I am hoping to see if there is a drupal way of handling it.
The character that I am having problem with is Â. It represent a space I believe and it only appear at end/and beginning of sentences.


texts: Why not all menus are available in context settings page?

texts:
I want to put main-menu to certain block via context.

But only few menus are available:

I've 3 contexts already, but none of them uses any menu.


texts: Adding a flag to Menu Content Link to display as a non-link

texts:
I have been struggling/failing for the last day to try find a way that I can add a flag/marker to the Drupal menu links that I can examine within the menu TWIG template to modify the link such that it becomes plain text instead of a menu link.

I am not using any menu modules, standard Drupal Menu with CSS to provide the drop down functionality and styling.

What I need is to be able to output a menu item as shown in the screen shot, specifically the 'Sell your property' & 'Essential Services' items which are unlinked headers.

Initially I attempted to use the contributed module menu item extras
 (https://www.drupal.org/project/menu_item_extras) which works fine from a menu management plugin point of view but then they change the markup way too much and it actually breaks the drop down functionality, so I cannot use it.

I then tried a second module which seemed simpler, i.e. Menu link content fields (https://www.drupal.org/project/menu_link_content_fields).

This module has some strange behaviour in that it makes the menu links fieldable. I can add a new field but after adding a field, it does not appear under the Manage Fields tab, and in the twig template the new field is un-available in the menu item object (Examined through xDebug)

Also, trying to remove this invisible field at a later stage seems difficult.

Question: How can I easily add some sort of marker to a menu item link  to allow me to modify the template output for said link. Or is the re a module that will allow then insertion of HTML markup/plain text instead of a link (Megamenu doesnt seem to allow this)

Also, I cannot seem to find the hook which deals specifically with a sites menu, i.e. the hook that is executed for each menu link. Does one even exist?

I'd like to avoid a hack whereby I put in a unique string into the text of the link and then examine this in the menu twig templates to see if that string exists to know if I need to modify it.


texts: Accessing imagecache path inside template

texts:
I'm using the ImageField module together with Imagecache to display a picture for one of my content types.

To display the content body I'm using Contemplate, I'm accessing the path to the image in the following way:

'[...]/imagecache/[preset]/[...]/'.$node->field_picture[0]['filename']

This usually works, but it breaks when someone uploads a picture with the same filename as the existing one. The file itself is then automatically named filename_0.jpg instead of filename.jpg, but the filename variable of the ImageField I'm accessing stays filename.jpg.

This of course leads to the old image being displayed. It seems the filename variable does not do what I expected, what would be the correct way to access the Imagecache generated files?


texts:
Drupal 7.

We want to remove tags (of Tags vocabulary) automatically when all pages referring to this tag are removed.

Is there a module for this?


texts: How to scp one file to remote using drush?

texts:
I'd like to send one file to remote host which is defined as alias in drush.

The file is actually private ssh key, so it needs to be placed in ~/.ssh.

I've tried the following command:

drush -v rsync conf/my_rsa @remote:~/.ssh/

but then it's saying:

You will destroy data from drush@remote:'/var/www/~/.ssh/'

I don't want to destroy any existing data in my ~/.ssh.

Any workaround to that?


texts:
I've a site that collects historical events.
I would to use calendar to display a block with events of actual the months (that, obviously, could be events in every year, also in XIX century).
How should I set the contextual filter to do this?

Generically I need a calendar of anniversary..

Thanks,
Sergej


texts: How to send an email using Rules to everyone in an Organic Group based upon a date field?

texts:
I have an OG content type with a date field. When the date in the field comes up, I want to use Rules to send an email to everyone in the group using the other fields (title/body/og name) in the node.

(Edit) My OG is "Teams" and the OG Content node type is "Events" with the date field.  So when field_date in Events is within 24 hours Rules will send out an email to all the OG Members of Teams.

I'm having a hard time wrapping my head around triggering the event based upon the date field and then send the node information to all the different users in the different groups.


texts:
I have a content type 'company' which has a field: field-paid. This field is a integer list who only has 1 option: 'yes'

This is my export of my rule:

{ "rules_testv2" : {
"LABEL" : "Depublish when not paid",
"PLUGIN" : "reaction rule",
"WEIGHT" : "1",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_i18n", "rules_scheduler" ],
"ON" : { "node_update" : [] },
"IF" : [
  { "data_is" : { "data" : [ "node:type" ], "value" : "company" } },
  { "data_is" : { "data" : [ "node:field-lid-" ], "value" : "1" } },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_paid" } },
  { "data_is_empty" : { "data" : [ "node:field-paid" ] } }
],
"DO" : [
  { "drupal_message" : { "message" : "Testing" } },
  { "schedule" : {
      "component" : "rules_delete_company",
      "date" : 1508823060,
      "identifier" : "Unpublish node [node:nid]",
      "param_node" : [ "node" ]
    }
  }
]
  }
}

Now I've tried like this (without my component) but still not working:

 { "rules_testv2" : {
"LABEL" : "Depublish when not paid",
"PLUGIN" : "reaction rule",
"WEIGHT" : "1",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update" : [] },
"IF" : [
  { "data_is" : { "data" : [ "node:type" ], "value" : "company" } },
  { "data_is" : { "data" : [ "node:field-lid-" ], "value" : "1" } },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_paid" } },
  { "data_is_empty" : { "data" : [ "node:field-paid" ] } }
],
"DO" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
  }
}

It unpublish all my nodes... But I have 2 nodes (for testing) that has value in 'field-paid' (checkbox) so normally those 2 nodes has to remain published...


texts: How to change the field name in the url when using views exposed sort?

texts:
I've read a few posts on this and there does not seem to be an answer to that, is that right?

My exposed filters allow the user to change the sorting, but the url is kinda bad:

?sort_by=field_rating instead of just ?sort_by=rating, for instance. Can this be achieved somehow? Is it advisable to try out better exposed filters module when you have already kind of customized your exposed filters? /:


texts: why does drush tag 8.0.0-beta14 returns all zero for config core.extensions

texts:
After a fresh install of d8 with several core modules activated (block, breakpoint, database logging, field, filter, internal page cache, node, system, toolbar, update manager, user, views, views ui), extracting the config indicates that all the above are off:

# drush8 @myproject.dev config-get core.extension
module:
  block: 0
  breakpoint: 0
  config: 0
  datetime: 0
  dblog: 0
  entity_reference: 0
  field: 0
  file: 0
  filter: 0
  image: 0
  node: 0
  page_cache: 0
  system: 0
  text: 0
  toolbar: 0
  update: 0
  user: 0
  views: 0
  views_ui: 0
  minimal: 1000
theme:
  stark: 0
  classy: 0
  seven: 0

stark is, in fact, the default activated theme and seven is the admin theme.

The plan is to dump the config from the dev server and then import it into the stage server; but this is tricky if the config dump from dev is "blank."

Is this what's supposed to happen?

I'm using drupal version 8.0.0-beta12, and drush version 8.0.0-beta14.


texts: How to get the value of a taxonomy term from entity reference using a token?

texts:
We have an Entity reference field on Basic Page content type that is set to Articles. The Articles content type has a field, field_category that is a taxonomy term.

What is the correct token to get the value of the field_category?

Basic Page:

field_articles -> entity reference to Article content type.

Article page:

field_category -> taxonomy term field.

Goal:

Return the field_category label from the Article node that is set on the Basic Page

Example:

Basic Page -> page1(nid=0)

field_articles = articlePage1 (target_id = 1)

Article page -> ArticlePage1 (nid = 1)

field_category = Cloud (tid = 10)

Token should return Cloud for page1.

We tried the following but it didn't work.

[node:field_articles:entity:field_category]


texts: Predefined webform configuration for specific content type

texts:
I'm new to Drupal, I need to create a job list page with an application form for each of the job listings presented in it.

I've created a "Job" content type, and installed the webform module

When I create a new Job, I'm able to create a form and present it in the content of the job.
The problem is that it has to be done for each specific job listing manually

Is there a way to set the configuration of the webform attached to a specific node by its content type?
A code based solution is preferred - but one that is based on action in admin UI is also blessed

Thank you very much!!


texts: Getting field value that attached to Commerce product field

texts:
From using commerce_price_savings_formatter, I've created field field_diskon where it only contains number. field_diskon purpose is for discount rate.

So, I can assign different discount rate for different SKU.

For getting value in field_specific_blabla attached to node, I can use:

// Extract the first field item
$specific_items = field_get_items('node', $node, 'field_specific_blabla');
$specific_item = array_shift($specific_items);

// Get the field value
$itemvalue = $specific_item['value'];

But how to get value field_diskon attached to commerce product field?

I have no idea what entity hold commerce field. I've tried replacing node with keyword related to commerce, but still not works.


texts: Install Drupal into a different directory than drupal-vm is installed

texts:
I installed Drupal Virtual Machine (Drupal VM) from drupalvm.com using vagrant. This worked fine - but I want to install the drupal files into a different directory.

How can I modify the Vagrantfile in order to install drupal and the drupal vm into different directorys (drupal not as a sub diretory of drupal vm). Thank you.


texts: Bulk import select element options of a Webform from CSV

texts:
I am using the Webform 8.x-5.0-beta16 module in Drupal 8.

I added a select field in which I would like to set around 250 options.

Is there a way to easily import these options from a CSV?


texts: Apache URL aliases not working with the visibility settings for blocks

texts: I have a page like example.com/abcd.php?url=efg with Apache aliasing it to example.com/product/efg. I don't want certain blocks to be visible on this page; when I use  product/efg in the block section, it does not take any effect. I wanted to know how to go about this issue.


texts: What might be stopping this Contextualised Filter work in Block (please)?

texts:
I am stuck making a contextualised filter in Block View (and I guess if I knew my question, I would also know my answer).

The view comprises

A set of images which I can see in the View before I set up the Contextualised View with their tags
Relationship with Content: Taxonomy terms on node, choose the correct Taxonomy, and check required
Under Contextual Filters, Taxonomy:name
Default View
Raw value from Url
Position is tricky  .. the path alias is albums/[node:title] but this is a multilingual site so en/albums/[node:title] (I have tried positions 1,2, 3)
Check Specific Validation Criteria
Validator:Taxonomy
Check correct taxonomy
Term Name
Tested check/unchecked spaces to hyphen
Additional information
The tag is input exactly as the [node:title]
If the [node:title] is Barking Dogs, then that is the tag. So the [node:title] is changed by Drupal to barking-dogs and so is the tag.  But the name of the tag is not.  The name of the tag remain Barking Dogs.
Results
When I put a tag name into the preview query, I get the correct results
a.  For one word tags
b.  When I type the phrase with space e.g. The Funniest Cat
When I type the shortened phrase, i.e., funniest-cat, I get no results. Checking the transform spaces into hyphens doesn’t help.
When I use the path alias /albums/[node:title], I get the title, such as The Funniest Cat, but no Block.
The Block itself works – If I request a summary when validation fails, that is displayed.  But no contextualised filter.

I am out of ideas. If anyone can spot where I have gone wrong, I’d be grateful.  Or have an idea how to test, as grateful.
Thanks.
Jo


texts:
Use-case-scenario:
There are multiple content types.
There is the webform module.
Context and Views are used.

Requirement:
Display specific webform below specific node.
The content editor should be able to choose specific form for specific node.

My first idea is:
->start with adding a node/entity reference field (lets call it "webform_node_url")in the webform, so that a webform is related with a specific node.
->create a view that renders all webforms that have "webform_node_url"
->Embedding this view in the context.

But the problem I have is, I cant find entity/reference functionality for the webform.
Do you have any ideas and/or suggestions.


texts: Alternative ways to group results of a view by CCK field?

texts:
I have cck content type with a variety of fields - video, taxonomy of terms, images, etc - in drupal 7, core 7.8. Unfortunately, I'm unable to group the results of the page view by a cck field by simply filtering and changing format settings by Group Field - UNLESS, I update my Drupal Core (tested w/ 7.12 and works easily). I am, however, able to group via using content: post date.

I've read through several answers on stack-xchg, ie. Grouping a View by Custom Field - but didn't really find an alternative way to group fields in the event I am not permitted to update core or modules.

Is there a way I can group fields by cck field via code? Thanks,


texts:
I need all nid array with multiple term field condition. I am using db_select() with join.

$query = db_select('node', 'n');
$query->innerjoin('field_data_field_condition', 'c', 'c.entity_id=n.nid');\
$query->join('field_data_field_skills', 's', 's.entity_id=n.nid');
$query->fields('n', array('nid', 'title', 'created'))
      ->condition(db_or()
      ->condition('c.field_condition_tid', 10)
      ->condition('s.field_skills_tid', 10)
        )
      ->condition('status', 1)
      ->condition('type', 'clinic')
      ->orderBy('created', 'DESC');
$result = $query->execute();
while ($node = $result->fetchAssoc()) {
 print_r($node);
}

This query doesn't show anything; I am using 10 as static value, just for example.

When I remove all joins and or condition, it shows the result like the following.

$query = db_select('node', 'n');
$query->fields('n', array('nid', 'title', 'created'))
->condition('status', 1)
->condition('type', 'clinic')
->orderBy('created', 'DESC');
$result = $query->execute();
while ($node = $result->fetchAssoc()) {
 print_r($node);
}

 Array (
  [nid] => 35
  [title] => Clinic 1
  [created] => 1486646343
  )
  Array
  (
  [nid] => 8
  [title] => Clinic 2
  [created] => 1485959105
  )
 Array
 (
 [nid] => 4
 [title] => Clinic 3
 [created] => 1485932987
 )

What am I doing wrong?


texts: Changing article text and summary with template_preprocess_node()

texts:
I use Drupal 7.9 with Views module (if the latter is important). I've created a small module for my site that changes transliteration of Japanese words in articles from Latin to Cyrillics and vice versa (yes, I need such a thing). User sees a form with radio button set, chooses transliteration, his choice goes to $_COOKIE and then I change transliteration in article summary and body based on user's choice. Or better to say I'm trying to change it but it doesn't work. The code goes like this:

function mymodule_preprocess_node(&$variables) {
    /* Suppose we have a summary containing only one word 'Yamamoto' that has to be changed to 'Ямамото' */
    $variables['node']->body['und'][0]['summary'] = 'Ямамото';
}

After this code is executed, the changed variable has the correct value of 'Ямамото'. But in the main page for some reason I see the unchanged 'Yamamoto'. What am I doing wrong? Do I change the wrong field? Do I mess up working with parameters passed by reference? Do I use the wrong hook?


texts:
I have a multilingual site. I am browsing from Holland and with the Smart_IP module i am redirecting to the correct language:

http://landberg.at/nl/ or http://landberg.at/de/

My default language is English. But now as user from Holland for example (dutch browser), you are NOT able to switch to the English homepage. This is because the homepage URL in English is http://landberg.at/ >> Then you are automatically redirect to http://landberg.at/nl/

Is there a solution for this?


texts: Can drupal commerce products become cheaper to the customer when they order more?

texts:
I would like to set up a shop to sell custom made products, all variations on the same base product.
The greater the number of tasks I have to do to get the product ready, the more expensive the product.

Some of these task do not require set up time for an order, but some tasks do.

Can drupal commerce take calculate the cost per item for a variation per product and the costs per order and turn those in to a sell price (the only price) the customer can see, based on the number of products they want to order?

Example:

Let's say, the products are cubes.

I can make a cube out of wood or plastic.
I can finish them by just sanding them, or paint them, or cover them in fabric.

Just sanding them is the quickest and thus the cheapest. Painting takes more time and is more expensive. Black is more difficult to get right then white, so again, is more expensive.

But also, painting not only takes time for the painting itself, it takes setup time for the whole order AND for every layer.

I would like to configure the products so that I can include most of these price factors in to the price the customer sees in the shop as they are changing the number they may want to order.

Because my typical order quantity is between 1 and 10, those diferences make a big difference in the price.

Can this kind of calculations be done with drupal commerce out of the box or with contributed modules, or would this require coding?


texts: Is it possible to dynamically disable a module at runtime?

texts:
Background:
I've got a multi-user/multi-channel project. Some channels are "classic" websites, but I've also got a channel that targets a non-interactive TV display. All channels are rendered using Drupal's templating (Technically a "channel" is just a theme, selected by a custom ThemeNegotiator acting on the current subdomain.) The problem is that some modules like e.g. Google Tag Manager or EU Cookie Compliance are unnecessary and disruptive on my TV channel.
Is there a simple way to dynamically disable certain modules at runtime?
The module should not be uninstalled, just inactive/dormant for the current request. I know that I could write module-specific hooks for each module I want to suppress. But I was wondering if - instead of writing a couple of different hooks - there is a single universal shortcut, something like the pseudo-code below:
if ($isMyCondition) {
  $modulesToDisable = ['eu_cookie_compliance', 'google_tag', 'foo_module', 'bar_module'];
  foreach ($modulesToDisable as $module) {
    \Drupal::something()->disableModuleForThisRequest($module);
  }
}


texts: I wrote a module that defines its own node type, adds the appropriate fields, etc.  How do I write an upgrade function if I wanted to change, remove, or add a field to the type?


texts: How to set #default_value for radio button on Ajax Callback?

texts:
I've a form having a radios and 'select list with Ajax callback event'. When user changed selection from the select box, I tried to set the default_value for radio button. but it doesn't work.

In the function check() I'm able to get the changed $id value every time I change the select list, but the default_value not working. it's always checked to the value 1 ('Yes').

I've tried like following but not working.

/**
 * Form.
 */
function myform($form, &$form_state) {
    $current_items = array(1=> 'Yes',2 => 'No');
    $form['current_items'] = array(
      '#title' => t('Change value'),
      '#type' => 'select',
      '#options' => $current_items,
      '#ajax' => array(
        'callback' => 'ajax_change_callback',
        'wrapper' => 'change-div',
      ),
    );
    $form['change_fieldset'] = array(
      '#prefix' => '
',
      '#suffix' => '
',
      '#type' => 'fieldset',
    );

    if (!empty($form_state['values']['current_items'])) {
      $form['change_fieldset']['checkin_form'] = check($form_state['values']['current_items']);
    }
    else {
      $form['change_fieldset']['checkin_form'] = check(1);
    }

  return $form;
}

/**
 * Form callback.
 */
function ajax_change_callback($form, $form_state) {
  return $form['change_fieldset'];
}

/**
 * Callback Form.
 */
function check($id) {
    $items = array(1 => 'Yes', 2 => 'No');
    $form['checkin'] = array(
      '#title' => $id,
      '#type' => 'radios',
      '#options' => $items,
      '#default_value' => $id,
    );
    return $form;
}


texts: How do I stop the site content from being internally indexed?

texts:
I have a Drupal 6 website, which is indexing the content for internal use. I don't use the Search module to search in the nodes, but The Search module is installed and enabled, since it seems to be required by the Google CSE module.

Is there anyway to stop Drupal indexing the content of the site?


texts: How to disabled Drupal builtin "poormanscron" cron when using Ultimate cron?

texts:
I want to disabled Drupal 7 builtin "poormanscron" to then put it into a crontab task as it should, but when using Ultimate cron module i do not see an option to disabled Drupal 7 builtin "poormanscron"

Do i have to uninstall ultimate cron?


texts: Search order by publish date or custom field

texts:
I wan't to order my search result first by publish date (or my custom date field), and then by relevance.
Recently posted on Content ranking are not working.
How to do this?


texts: How do I know if a link has the "active" class?

texts:
I've added a custom twig template for links--language-block.html.twig.

Inside of it, I want to render additional HTML when the current item is active. But I can't figure out how to check when the current item is active.

{% if links -%}
  {%- if attributes.hasClass('inline') -%}

  {%- else -%}

  {%- endif -%}
    {%- for key, item in links -%}

      {% if item.attributes.hasClass('is-active') %} << this is always false

foobar

      {%- endif -%}

        {%- if item.link -%}
          {{ item.link }}

          {# Deutsch  #}
        {%- elseif item.text_attributes -%}
          {{ item.text }}
        {%- else -%}
          {{ item.text }}
        {%- endif -%}

    {%- endfor -%}

{%- endif %}

How can I check if the link as the active class?


texts: How to translate a custom token in rules, private message, and other modules

texts:
I made a custom token to use as an email signature in emails sent by the Rules module and private messages (sent using Private Message).

I defined the token as follows:

  else if ($type == 'site') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'signature-team':
          $replacements[$original] = t("Best,")."<br>\n".t("My team");
        break;
      }
    }
  }
  return $replacements;
}

My site has two languages, English and Japanese.  I have translated the emails, rules, and tokens into Japanese from English (the main language).

However, even though the subjects and bodies of the emails and private messages appear in Japanese, the token is always rendered in English.  How does token determine which language to use, and how can I get it to pick up my translation in rules, private messages, and elsewhere?


texts: How to disable "add comment form" from a OG group content?

texts: When I'm showing content that belongs to a group I don't want to show the "comment form" to users that don't belong to that group. How can I do that?


texts: Using Feeds XPath Parser to create multiple entities from a single, denormalized element

texts:
Here's an example element from my source data:

<relation name="parent" active="#Mom #Dad" passive="#child1 #child2" />

From this source, I want to create 3 different entities (relations):

#Mom -> #child1, #child2
#Dad -> #child1, #child2
#Mom <-> #Dad

The problem is the data is so terribly denormalized compared to what Feeds expects. I'm not sure whether to tap into the feeds import process using some crazy hook implementations, or whether to just build a script to reformat the data before sending it to Feeds in the first place.

Thoughts?


texts:
I'm trying to create a custom module that builds on top of imagecache and imagecache_actions to dynamically add an overlay to image thumbnails based on fields of the node its attached to.

I used hook_image_default_styles and hook_image_effect_info with a callback to my custom effect function. I have it working under most circumstances, but I have a bug thats causing it to fail under some specific circumstances.

The problem I'm having is that there is no way to debug it. Normally for debugging, I run eclipse with zend debugger to set breakpoints and step through lines of code.

I've set breakpoints for the above functions. Cleared the existing files from the style directory, and loaded the page in the debug mode. All my other breakpoints will get hit, but for some reason its able to generate the image without hitting those breakpoints. I know its being called because (1) the image with overlay is being generated properly, and (2) every once in a while it was hitting the breakpoints - but not consistently, and now, not at all.

Does anyone who is familiar with imagecache know how this might be happening? Maybe it is somehow generating the images in a different php request than the standard page load?

Does anyone who uses a debugger know why this might occur, or has anyone seen this behavior before?


texts: How to extend or "hook" Drupal Form AJAX?

texts:
I'm working with standard admin form, which has 'add_more' button for one of fields.

My task is to move some fields to jQuery UI Dialog just for usability. When dialog was closed I manually append it's content to form so It sends normally.
The problem appears when some core ajax is sending while some form parts are in the dialog (i.e. outside of form tag because jQuery UI Dialog appears in the bottom of body). The 'add_more' button as example. When I click on it, the form serializes for AJAX without some inputs in the dialog.
Оh..
The jQuery Form Plugin (which used by Drupal) has option beforeSerialize. I think it can help me but I don't know  how I can extend Drupal.ajax.options to set something custom.

If you can recommend other ways to solve my problem or give some links to documentation about Drupal JavaScript, I will be very happy :)

Thanks.


texts: How exactly do I create a variation of a .tpl file?

texts:
I am new to Drupal and am working on a partially complete site. There's a .tpl file I wish to duplicate and alter and have only be used with a certain Panel Page type ('Product Page').

I've read Drupal's documentation about template suggestions, but am not sure what to actually do.

I've placed the following in my template.php file:

function mytheme_preprocess_node(&$variables) {
  if ($variables['???']) {
    $variables['theme_hook_suggestions'] = 'new_tpl_file';
  }
}

But I've got no idea what to put in $variables[''] so that the suggestion appears on my pages. I know my Panels page is called 'Product Pages' but that's it. Is there a machine name for that I can use as a variable? Would it work if it was something like:

      if ($variables['product_pages']) {

Does anyone know of a tutorial or guide out there? Im pretty lost here. Any help is appreciated!


texts: What is the feasibility of using Entity Reference instead of Taxonomy?

texts:
I read an opinion that argues for using Entity Reference to content types as a complete replacement for Taxonomy, on the basis of UX and performance. The UX issue appeals to me - happy content managers (who don't have to go dig around in Taxonomy ever) is important!

In considering this strategy for a new site that will be essentially built around one content type that can be tagged lots of different ways, I have a couple questions:

Is there really a performance difference? Can it be quantified?
I need hierarchy support. Is there a good option? Searching around, the land of Entity Reference hierarchy options exists but seems like a wild west at this point.
Are there better solutions if my only complaint is site admin UX?
Taxonomy is the best-practice, as it is in core, for the general use case. I'm wondering what else I haven't considered in going off the beaten path here.

(Note a very similar question has been asked before, but it is talking about using Entity Reference to taxonomy terms, rather than replacing the Taxonomy module. I also understand the purpose of Taxonomy, but am wondering what would make alternatives worth considering.)


texts: Can I clone the current state of a site when running tests?

texts:
I would like to prove that a series of permissions defined from a module are applied to certain roles. I need to test it both on a Drupal installation done from scratch and on a Drupal installation that clones the state of an existing site.

Is this possible?


texts: problem with rendereing tableselect through ajax callback function

texts:
Have a simple form including few of the input elements that should show up the data (based on the input) on tableselect (part of the same form) through the ajax callback functionality.

//submit button
    $form['action'] = [
    '#type' => 'button',
    '#value' => $this->t('Submit'),
    '#ajax' => [
    'callback' => '::setMessage',
    'prevent' => 'click',
    'wrapper' => 'scrollable',
    'method' => 'replace',
    'effect' => 'fade',
    ],
    '#suffix' => '

',
    ];

and within my ajax callback function:

public function setMessage(array $form, FormStateInterface $form_state) {
     $options = array();

     $header = [
       'subject_id' => t('Subject ID'),
       'ct_availability' => t('CT Availability'),
       'sex' => t('Sex'),
       'race' => t('Race'),
       'cardiovascular_disease' => t('Cardiovascular Disease'),
       'registration_age' => t('Registration_Age'),
       ];

    $options = $this->getOptions(); //getting the associative array
    dpm($options);  //printing to make sure that the array is filled

//assigning to the table
    $form['table']['#header'] = $header;
    $form['table']['#options'] = $options;
    return $form['table'];
}

The header gets assigned fine and the table is displayed only with it.
The data doesn't get filled and it seems the #options does not get assigned to the tableselect thus showing no data.

There are no ajax errors from the console

Wondering if it has something to do with 'processTableselect' function or rebuilding the form before returning the table element?

Or if it is a wrong approach to assign form element attributes within the callback function?


texts: Problems w/ themes and multi-site installation

texts:
so i'm currently migrating a single install drupal site into a multi-site drupal install, and for some reason it doesn't seem to be picking up my templates... which is a bit odd considerign that when in the drupal admin interface on the actual client facing CMS I can see that i'm in the correct "theme" which is a custom theme called "press".

however, drupal isn't using my page.tpl.php file. So what I did was hit the main drupal install and opened up bootstrap.inc and found that it is finding the correct directory for the conf and everything... not sure what else to do.

something that's interesting is that if I ping my site on localhost it looks as though it's pulling in 1 block (which should be displayed on the homepage), no wrapper, no menus, etc (which is why i think it's not using the correct templates, also the html is formatted differently than when it uses the correct template).

this is what i did to migrate

moved moved settings.php/modules/themes/files into the drupal/sites/mysite
reconfig'd my httpd.conf to point to the right site (it is).
reset my file path from sites/default/files to drupal/sites/mysite/files

using - drupal 7

curious if anyone has any advice or knows how I can investigate this further.


texts: How to set an exposed filter to enable current user to view nodes that he has not commented

texts: On my D7 site I am trying to create an exposed filter where current users would choose whether he wants to see all nodes, or only those that current users have not commented. Tried adding 'Comment: Comments of the node' and 'Comment: Author' relationships, 'Comment: Author uid' contextual filter. I didn't want to set a  default value because I want users to switch between all nodes and ones commented by current user. Then I added a filter criteria 'Comment: Author uid' with setting up grouped filter using [current-user:uid] token. No success yet.


texts:
I'd like to get Term ID by its custom field. I would like to do this using EntityFieldQuery().

Here's what I have so far:

  $query = new EntityFieldQuery();
  $entities = $query->entityCondition('entity_type', 'taxonomy_term')
    ->propertyCondition('vid', '1')
    //I need help with this line:
    ->fieldCondition('field_foo', $fieldValue)
    ->range(0,1)
    ->execute();

Update - I'm providing screenshots to make it more sense.

Here's a view of the custom field

I'm basically trying to get "myTermName" Name field, by "myValue" Foo field.


texts:
Is there still a way to exclude administrative paths from using the CDN module in Drupal 8?

It appears you have to use advanced mappings, but I don't understand how.


texts: How to return values to widget form from view in ctools popup?

texts:
I'm writing custom field type and widget based on it. It allows to create custom entities from node page and add node references on existing nodes.

There are no problems with custom entities they added via ajax and pass again to widget by $form_state. For referencing existing nodes I'm using entityreference view and ctools popup. The problem is deliver back values selected in a view.

Common way to solve this - is custom submit callback for a view and ajax_command_replace() widget html.

But it's not useful in my case, because I'm rebuilding form all the time and only valid data is in $form_state.

Any ideas?


texts:
Considering Drupal\search_api\Plugin\views\query\SearchApiQuery class, I want to override shouldAbort() method there.

I have tried to create a new plugin class in my custom mod:

namespace Drupal\my_mod\Plugin\views\query;

use Drupal\search_api\Plugin\views\query\SearchApiQuery;

/**
 * Defines a Views query class for searching on Search API indexes.
 *
 * @ViewsQuery(
 *   id = "search_api_query",
 *   title = @Translation("Search API Query"),
 *   help = @Translation("The query will be generated and run using the Search API.")
 * )
 */
class MymodSearchApiQuery extends SearchApiQuery {

  /**
   * @inheritdoc
   */
  public function shouldAbort() {
    //do something fancy
  }
}

But it seems to not work. How can I do it properly?


texts: How to create a new widget for a plain text field

texts:
I have a text field in a content type in the admin. This week I only like people to fill in, say the words yes, no or I forgot. I don't want to create a new field type. Next week, I will implement yet other choices or maybe I'll just give them the plain text widget back.

Why does this not work? I doesn't even show up as a widget for a text field?

     /**
     * Implements hook_field_widget_info().
     */
    function MYWIDGET_field_widget_info() {
      return array(
        'MYWIDGET_field' => array(
          'label' => t('MYWIDGETNAME'),
          'field types' => array('text'),
        ),
      );
    }
    /**
     * Implements hook_field_widget_form().
     */
    function MYWIDGET_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
      switch ($instance['widget']['type']) {
        case 'MYWIDGET_field' :
          $element['MYWIDGETVALUE'] = array(
            '#type' => 'select',
            '#title' => t('MYWIDGETLABEL'),
            '#default_value' => isset($items[$delta]['MYWIDGETVALUE']) ? $items[$delta]['MYWIDGETVALUE'] : '',
            '#options' => array(
              '1' => 'Yes',
              '-1' => 'No',
              '0' => 'I forgot',
            ),
            '#required' => $element['#required'],
          );
          break;
      }
      return $element;
    }


texts: How do you hook into a path being created via pathauto?

texts:
I can't seem to make hook_pathauto_alias_alter() get called in my custom module, in either 1.x or 2.x. I'm not certain, but I'm not clear if this hook is even in pathauto 1.x.

I am trying to hook into a Pathauto alias right before it's saved, so I can make some changes to the path (remove certain words). How do you do this? Is there another method besides a hook in the Pathauto module?

I have a module that let's the user enter in a list of words they want to filter from nodes; I would prefer not to enter it in two places.


texts: How do I enable language without importing translations?

texts:
I need to enable a lot of languages on my site and I do not want Drupal to download translations since only few forms and pages will be actually translated on the front end so I'll handle that manually.

Is there some way to disable this or do I have to enable all languages and then just flush the locales tables so that those unused translations don't take up the space?


texts: How do I group two nodes on the frontpage in a div?

texts:
I want to have every two articles on the homepage within a div structure.

However, I can't get this done in my node.tpl.php file: if I use the zebra variable to print a  tag before the node when zebra is odd, and a closing  tag after the node when zebra is even then this only works when there are an even number of articles, or otherwise the last div won't be closed.

In code:

<?php if($zebra=='odd'): ?>

 <?php endif; ?>

 <div id="node-<?php print $node->nid; ?>" class="[..]">
 [rest of node here]

 <?php if($zebra == 'even'): ?>

 <?php endif; ?>

To make this work, I must be able to know when a node is the last one. But there isn't a variable $last in the node template file, neither is there a $count variable that hold the total number of nodes.

Does anyone has done something similar before?


texts:
Hi guys i'm trying to create a restaurant menu like below:

I've created a 'Venues' content type, in which it contain the usual Title, Description, Image and another Taxonomy field for Category (Type of Restaurant).

At the bottom i'd like a tabbed menu like the image above. Just not sure how I can go about creating it. Ideally i'd like:

Let the user create up to 4 or 5 tabs
Each tab to have a title (Which is displayed in the section and on the tabs)
Each tab to have X amount of items (Name, Description Price)

Not sure if there's a module that helps with this or if I should use Views somehow or what fields I should add to the content type. Totally baffled.

In my static HTML prototype, I used jQuery UI to build the tabs, will I need to use that again here or again, is there a module that can help with that?

Thanks for your help :)


texts: How can I load content on the same page from a search

texts: So the idea is to load the results of the search on the same page. I was told to look into SOLR, but it looks like we have something similar to SOLR , and we just need to know how to load new page content into our drupal site. Alternate to iFrame.


texts: Output tabs and content in different regions?

texts:
The default behaviour of Quicktabs is to make accessible a block containing the tabs and the linked content. That doesn't meet my requirements, unfortunately.

Is there any way of theming Quicktabs module (7.x-3.2) in such a way, that the tabs are output in one region (eg. right sidebar in page--nodetype.tpl.php) and the linked content is displayed in the main content region? Or is it stretching the concept of tabs too far?


texts: Composer installation of drupal console missing functions

texts:
I've been attempting to install drupal console for the first time ever. I was looking for a means of creating boiler plate modules, blocks etc.

My issue is when I have finished the installation process, the following list of functions seems incomplete according to everything I have read online. Incomplete because there is only one generate function and nothing to generate blocks, modules etc:

Available commands:
  about                        Displays basic information about Drupal Console project
  chain                        Chain command execution
  check                        System requirement checker
  exec                         Execute an external command.
  help                         Displays help for a command
  init                         Copy configuration files.
  list                         Lists all available commands
  server (serve,rs)            Runs PHP built-in web server
 database
  database:add (dba)           Add a database to settings.php
  database:client (dbc)        Launch a DB client if it's available
  database:connect (dbco,sqlc) Shows DB connection
  database:query (dbq,sqlq)    Executes a SQL statement directly as argument
  database:restore (dbr)       Restore structure and contents of a database.
 debug
  debug:chain (dch)            List available chain files.
  debug:dotenv                 Debug Dotenv debug values.
  debug:settings (dse)         List user Drupal Console settings.
  debug:site (dsi)             List all known local and remote sites.
  debug:update:composer (duc)  Displays current updates available from the composer file
 develop
  develop:contribute           Download Drupal + Drupal Console to contribute.
 docker
  docker:init                  Create a docker-compose.yml file
 dotenv
  dotenv:init                  Add support and required config to work with an .env file
 generate
  generate:site:alias (gsa)    Generates a site alias.
 quick
  quick:start                  Download, install and serve a new Drupal project
 settings
  settings:set                 Change a specific setting value in DrupalConsole config file
 site
  site:install (si)            Install a Drupal project
  site:new                     Download a new Drupal project

I used the following command:

sudo composer global require drupal/console:@stable

Can anyone pleas advice me on how I can get a more complete list of functions?

UPDATE:

I don't know if this error showing as the first output when drupal is executed in my terminal, has anything to do with my issue:

 [ERROR] Class Drupal\Core\DrupalKernel does not exist.

So far my attempts to google that error have turned up no solutions.


texts:
I have a content type with two fields: Exterior Images and Interior Images

Both of these fields are Unlimited Values - so the user can upload as many images as they want to exterior and interior. Screenshots: http://prntscr.com/a9m8o5 http://prntscr.com/a9m8uc

Now I'm trying to create a view that grabs all exterior and interior images uploaded and displays them.

The only way I can find to have each image displayed as its own individual field and row is to perform a UNION betwen something like SELECT exterior UNION SELECT interior etc. etc. but I just can't seem to figure out the rest.

I've tried creating two views and combining them like this:

function pgallery_views_pre_execute(view &$view){

    if ($view->name == 'photo_gallery'&& $view->current_display == 'page_1') {
        // View 1 contains Interior Images
        $view1 = views_get_view('photo_gallery');
        $view1->build('block_1');
        $query1 = $view1->build_info['query'];

        // View 2 contains Exterior Images
        $view2 = views_get_view('photo_gallery');
        $view2->build('block_2');
        $query2 = $view2->build_info['query'];

        $query1->union($query2);

        $view->build_info['query'] = $query1;

    }

}

but it won't render whatever is in $query2 - it just repeats $query1 values. So I get the correct number of "rows" from the result but it repeats the data for some reason. Please help!


texts: How can I check, if node has a new (unpublished) revision in node-template?

texts:
I have user created content. I use the content-moderation plugin, so user can update their nodes but the updates will only be published after moderation. I like to display a little batch (has new unpublished update) on the user-nodes, to give the user an information about the moderation state.

For nodes with new revision in draft-state shows drupal a "last-version"-link in node-links-menü. It must be possible to check, if there is a new revision in draft state (in preprocess_node). Who can help me and write a little php code for this check so I can generate a twig_variable "has_draft_state".

Thanks in advance


texts: How to make a user not being able to publish his content?

texts:
how is this possible to make a user/role not being able to publish content he has created ,but to be able to create new (unpublished) content?
thanks


texts: Pauthauto breaking for one specific page

texts:
I have a Drupal 8.7 site with a content type for which I have just activated automatic URLs via pathauto.

We have a number of pages using this content type, and all of them worked perfectly when I activated the alias... except for one, which remained stuck as /node/9669.

I investigated this, and it turned out that the content editor who created the page had unticked the 'Generate automatic URL alias' checkbox on this particular page, hence why it didn't pick up the new pathauto alias.

So I thought it would be a simple thing to tick the box and it would work.

I ticked the checkbox and saved the page, but what actually happened is that it now gives me a browser error saying "page isn't redirecting properly" (Firefox) or "too many redirects" (Chrome).

I have tried regenerating the aliases, manually changing the alias, deleting the alias, recreating it... but nothing I do is getting the page back.

My guess is that there's something that's gotten saved in the pathauto database tables for this which is broken, but isn't showing up in the admin panel.

Can anyone please help me understand what's going on under the hood here and fix this alias.

Thank you.


texts: Is "access administration pages" a valid access argument?

texts:
In Drupal 7, it appears that access administration pages is a VALID access argument. Is this the case?
How can I determine all the correct access arguments?


texts: how to achieve a sliding effect to show the rest of elements in a grid, with views

texts:
I have a view set to grid, displaying 5 items per column. I set it to display 5 items at a time too, but I have 10 items total. What i want to achieve is, when I click on page 2, instead of having it load the rest of thumbs, for them to slide into the position of the first 5 items displayed. It would be something like SlideShow effect, scroll to the left, but instead of displaying a single frame, displaying 5 at a time.

Im using drupal 6x, views, (cck of course), and have slideshow installed but I couldn't manage to figure it our on my own. I appreciate any prompt response.


texts: How to filter nodes by role (Content Access for nodes activated)?

texts:
I have activated content access per node, so that I can control the access of the node directly on the node.
Now I want to create a view, with an exposed filter. The filter should contain the roles which are activated directly on the nodes.
So that I can find nodes which have maybe role A and B activated but not C.

Matroschker


texts: drush updb fails with "the 'media_delete_action' plugin does not exist" after 8.4.6 > 8.5.1 update

texts:
We have recently updated a Drupal 8.4.6 installation via composer to Drupal 8.5.1. After the composer update I ran

drush updb

as usual. However, the command fails at one point with the following error message:

Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "media_delete_action" plugin does not     [error]
exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of
…\htdocs\casali\web\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).

After that, every drush updb wants to do the following updates, since they are never completed:

system module :
  Change plugin IDs of actions.
  Clear caches due to schema changes in core.entity.schema.yml.

views module :
  Update dependencies for moved bulk field plugin.
  Add additional settings to the entity link field and convert node_path usage  to entity_link.
  Add placeholder settings to string or numeric filters.
  Fix cache max age for table displays.
  Include views data table provider in views dependencies.

I am not quite sure what to do here. As far as I have researched, media_delete_action is part of the media_entity module. However, that module is already part of the core in Drupal 8.4.x (https://www.drupal.org/project/media_entity).

If I run

drush en media_entity

it tells me

media_entity was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                    [ok]
media_entity
Would you like to download them? (y/n):

But I don't think I should have to do that, since it's already part of the core?


texts: How to resize an uploaded image based on the longest side?

texts:
I can't seem to figure out how get ImageCache to resize an image based on the longest side.

Desired behaviour:

upload image 800x532 --> resize image to 400x266 (landscape)
upload image 532x800 --> resize image to 266x400 (portrait)

Is this possible with ImageCache? If not, how can I achieve this? Aspect ratio must be preserved.


texts: Do features uninstall variables when a module is uninstalled?

texts:
I have created a module using The Features module. The module exports some variables using the Strongarm module.

If a person installs the module and then uninstalls it, will those variables be removed?


texts:
I'm trying to create a team roster content type. Each team member has first name, last name, tel number, character name and a photo.

Attempt #1:
 I've installed NameField module which allowed me to add/edit players on the team. The problem with Name field is that i can create unlimited number of players in team roster, but namefield doesn't provide a field to upload a photo to each of them.

Attempt #2:
I tried to create a content type called 'Player' with fields for name, photo, and tel number. Then create a View with sorted table. My problem: User needs to constantly click add Player to create more than one player. Is there any way to make it more user-friendly?  For example,
Just click 'Add one more field' without getting into content creating menu?

Question:
Approach to create sorted table view of players name, tel. number, and photo?


texts: How on node forms do I show weight of all menu items?

texts:
I'm wondering how it is possible (with a hook) to show the weight next to the menu title in the parent drop down found in the Menu Settings tab.

So this is what it is at this moment:

And this is what I want it to be, so the admin knows what weight to fill in to place the menu item at a certain place:


texts: Copy data from Webform submission to a node?

texts:
I have pre-existing node authored by each user. However, for presentation purposes, I use a Webform to collect data from the user.

Existing Node: Assessment

field_question1
field_question2
field_question3

Webform

field_question1
field_question2
field_question3

On submit, I would like to compare "the user submitting the Webform" with the author of existing nodes, then set the field values of the submitter's existing node with the new values from the submitted webform.

This worked well in Drupal 7, but in Drupal 8 I don't seem to understand the syntax, nor do I see a place to set up or pass variables.

Can this be done in the current state of Drupal 8 Rules?


texts: Multisteps Webform loses current page when refreshing browser

texts:
I've created a Webform with three steps. When I refresh the browser (F5) on step 1 and 2, I correctly remains in the same page.

If I do the same in step three, I go back to step 2. For ALL the steps > 2, when I refresh the page I go back to step 2.

I tried to change same Webform settings ("Allow cookies for tracking submissions" and "Automatically save as draft between pages"), but with no results.

I'm using an anonymous user to browse the Webform's pages.

Anyone has a solution?


texts:
I need to theme certain form fields on the user profile form page differently from other fields, for which I am trying to create a theme function that outputs html its own way, not using theme_form_element(). The reason for defining a new theme function alternative to theme_form_element() is because the html output is dramatically different.

This is my code:

function mymodule_theme() {
  return array(
    'profile_form_element' => array(
      'variables' => array(
        'element' => NULL,
      ),
    ),
  );
}

function mymodule_form_user_profile_form_alter(&$form, &$form_state) {
    $form['field_user_first_name']['#theme'] = 'profile_form_element';
    dpm($form['field_user_first_name']);
}

function theme_profile_form_element(&$variables) {
  $element = &$variables['element'];
  // my html processing would start here...
}

...but the theme function has NULL for $variables['element']. What am I doing wrong? I am attaching the structure of my form field (field_user_first_name), which was created through the UI at configuration > people > account settings > manage fields.


texts:
I have a Drupal 7 site with a content type called Weekly Repeating Event, and events of this type repeat at the same time and day each week.  I use a custom template file to display this node type by printing the fields, e.g.

print render($content['field_event_date'])

I understand how to use display types and how to make the repeat rule display, but for the life of me I cannot figure out how to display ONLY the dates that we list as "Exclude Dates."

I want the node to have a heading that says "No Meetings on the Following Dates" and to display any future dates from NOW (date the node was viewed) that the group is not meeting.

I can't figure out how to create a view of this, nor can I figure out how to make this happen within the template file.

All help appreciated.


texts: Feeds Api conditionally skip deletion of terms

texts:
I have a taxonomy vocabulary of customer addresses as terms that I maintain via the Feeds module. Most of the terms will be added via the Feeds import, however I want users to have the ability to add an address term to the vocabulary and not have those particular user added terms deleted when feeds does an import (feeds should still remove terms that aren't marked as user created if they're not in the imported CSV file)

Is there a way in Feeds API to skip deletion of terms that have a particular field value?

Thanks


texts:
After a lot of searching, I've been unable to find the answer by myself, so here's my problem (with Drupal 7) :

I've been able to add new fields to my user registration form (config/people/accounts/fields) and even hide fields on the form... But I would like to do the opposite : display a field on the registration form whose only purpose would be to assign a value to another field upon validation. There would be no need for this field to be stored in the database (like a transient property in Java).

Is there a way to achieve that ?
Thx


texts: How to make drop down field as mandatory field in views exposed filter?

texts: I need to make one of my drop down field in views exposed filter as mandatory field.How can I achieve this?


texts: Drupal Multisite, same module name, different site

texts:
We have a module that needs to be the same name, but its functionality will change for each site.

Is it an ok practice to put put them in sites/site1/modules/MODULE_NAME and sites/site2/modules/MODULE_NAME

Will this cause any problems with drupal if they have the same name, but are in different sites?


texts: Display custom form mode in twig with drupal_entity_form

texts:
I am using the form_mode_manager module for creating new form modes.
I have currently a new edit form mode which is called applicant, but whenever I add the drupal_entity_form function in my twig template, it says:
The "node" entity type did not specify a "applicant" form class.
Does anyone know how to resolve this?


texts: Drupal UserLoginForm vs UserAuthenticationController login function - which to override?

texts:
I have a drupal site where I am customizing the login by validating credentials against an OAuth2 provider, implementing the OAuth2 password flow, basically what this module does, except I am using D8 and this is for D7

https://www.drupal.org/project/oauth2_authentication

I upgraded that module to D8.  It works by adding a replacing the validateAuthentication function in the #validate array of the form with an implementation that validates against the external OAuth provider.  I upgraded all that to D8, but then I noticed in D8 that the login method of the UserAuthenticationController is also called to validate credentials.

So I have a couple questions

These two things both do basically the same thing.  Both pieces of code (UserLoginForm and UserAuthenticationController) validate against the user table in the DB.  Why are both doing essentially the same thing?  Are they both actually being called?
I realize it would be a cleaner implementation (and more Drupal 8-like) to override the UserAuthenticationController.  If my module registers the /user/login route to a different controller (provided by my module) will this override the default mapping to the UserAuthenticationController?

Thanks in advance.  I am new to drupal so any help would be appreciated.


texts: Make user logged in after created by rule

texts:
I have an entityform on my Drupal website, which helps me to generate leads. I've configured a rule, creates a new user by that entityform's e-mail and name fields. (Similar scenario is told here.)

I need that user (created by rule) to be logged in, after creation. What should I do?


texts:
I have created the settings.local.php file inside the default folder and uncommented the the following lines.

$settings['cache']['bins']['page'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

I also uncommented code in settings.php file, but Drupal is still caching the code. What's the solution for this? I am using Drupal 8.6.10.

I added these parameters in the development.services.yml file.

parameters:
  twig.config:
    debug: true
    auto-reload: true
    cashe: false

The settings.php file contains the following lines.

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
   include $app_root . '/' . $site_path . '/settings.local.php';
}


texts: Does anyone know away to create custom entities from Drupal 8 UI that is not ECK? I try it out using ECK and still a little bit buggy.


texts:
I want to pass parameters to the URL. With node/1/param1/param2, it works. If node/1 has the contenu/accueil path alias, contenu/accueil/param1/param2 returns a 404 error.

How do I pass parameters to the URL even when there is a path alias defined for the URL?

The Pathauto module is disabled.


texts: How to avoid clearing the cache after every CSS change?

texts:
I use D7 and I'm tired of clearing the cache after every css change (I make lot's of changes to my online site, about ten's in a day)... Clearing the cache ten's of times a day consumes too much life time for me and I really had enough of it.. Yes - Even if it is made by the Admin Menu module.

Is there any way to temporarily disable the cache or something of the sort?

Notes:
Screenshot of my Performance settings attached.

Clicking ctrl+R never helps
Clicking ctrl+F5 never helps


texts: Programmatically Setting Content Ranking Factors For Drupal Search

texts:
I've added a dropdown to Drupal search page interface. I would like for users to be able to select this control to sort results according to Date or Keyword Relevance.

I'm able to get the dropdown value in a submit handler, however, I don't know how to programmatically alter the weight of 'keyword relevance' and 'date'.

Here is my submit handler. Any help would be greatly appreciated.

function test_sort_form_submit_handler($form, &$form_state) {
  drupal_set_message("Drop Down Value Is: " . $form_state['values']['search_sort']);
}


texts: Twig invalid render array keys from a valid array

texts:
In hook_preprocess_menu I am creating an array to send to the menu twig tpl (eventually it will be entity paragraph data but for now they are hard values as examples). However, I just receive array key invalid errors. How should this be formatted correctly for the template?

function hook_preprocess_menu__main_menu(&$vars) {

  $node = \Drupal::routeMatch()->getParameter('node');
  if($node->field_menu_highlights){
    $highlight_values = $node->get('field_menu_highlights')->getValue();

    foreach ($highlight_values as $key => $item){
      $ent = \Drupal\paragraphs\Entity\Paragraph::load($item['target_id']);
      $vars['highlight'][$key]['title'] = 'Title here';
      $vars['highlight'][$key]['desc'] = 'Description here';

    }
  }
}

The template:

{% for value in highlight %}
    {{ value }}
{% endfor %}

Error eg:

User error: "title" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).


texts: My webform seem fine except I cant see the result. When I click result, it will state Server error 500. All my webforms face same problem. I had tried create new webform and tried again. As a result, same problem. FYI. This website is duplicated from another website by copy files and database and place it at another domain. Here is my question: How to check what is the actual problem?


texts: Adapting a superfish menu to what I want

texts:
I am getting acquainted with Drupal 7 right now. One of the things that I have consumed a lot of time doing is understanding theming and getting the kind of Menu I want for my website.

I am using a subtheme of Bartik and have a Superfish menu (parent menu : main menu) rendering itself in the Highlighted region.

My grouch is that the menu does not render itself for the full width of the screen. The next is, I need to trigger some design changes to my menu itself which I am not sure how to.

Any leads people?


texts:
How to get all node tabs (MENU_LOCAL_TASK type) which available for current node?

I mean node/%/edit, node/%/translate, node/%/devel etc.

I've tried to use menu_local_tasks() but it shows only empty array.


texts:
In my View (using v 3.11), I have a grouped filter exposed. It should show one label for values containing one string OR another, for example:

label -> fruit
operator -> contains
value -> apple OR pears

I don't want to make two equal labels. It's possible to do that?


texts: Commands doen't work because of the Address module and its dependencies

texts:
When I try to use a Drupal Console command, even a simple a drupal list, I get an error.

  Fatal error: Class 'CommerceGuys\Addressing\AddressFormat\AddressFormatRepository' not found in /path/to/my_project/web/modules/contrib/address/src/Repository/AddressFormatRepository.php on line 16

Of course, the last AddressFormatRepository extends the other and has
use CommerceGuys\Addressing\AddressFormat\AddressFormatRepository as ExternalAddressFormatRepository;.

The namespace is good, classes exist, so I don't understand why I get the error.

The composer.json file contains the following lines.

"drupal/address": "~1.0",
"drupal/console": "^1.0.2",
"drupal/core": "^8.6.0",

I tried to update the Address module, manually install the dependencies with Composer, but nothing changed.

Do you have any idea?


texts:
Is there a way a person can ensure that if he makes a change to a drupal 8 website via the UI (e.g. Adding/modifying a field to a content type, creating/editing a view) that this can be automatically applied to another developers localhost on the git pull or on a staging/production server?

Currently (I have moved from Drupal 7) I am doing this manually which is a pain. I've been told that Features is the way to go from Drupal 8 (and Drupal 7 apparently).


texts:
I am working on Search API. I am using Search API module, Facet API, Search API ranges, Pretty Paths modules to add facet filters.

All the filters working fine like select list, checkbox but Min/Max slider not working. When I am moving the slider, it gives 0 results to me.

How can I solve this problem ?


texts: Node Reference, and Entity Reference are great; I need “Menu reference”

texts: Is there a Menu reference module I can use to attach menus to nodes, and render them on the page?


texts: How to display list of files under a particular directory in Drupal?

texts:
I've created a custom module to export node data of different content types into Excel (using PHPExcel hooks).

That will be stored into particular directory called "Reports" under site/all/files directory.

Now I would like to display the list of files exists under "Reports" directory, in a page/view in a table format.

How can I achieve that?


texts: Drupal views filter with latest month with content

texts:
I am working to show a page that will display a current issue section, by which all the articles from the latest month whatever articles were posted are only shown.

Suppose the last posted set of article are December 2015 and after that nothing is posted, that view must show all articles posted on December, 2015. If the last posted set of articles were on January 2016, it must show list of articles posted on the month of January 2016 like that.

How it can be adjusted in views ?


texts: How to add menus to my footer block (nested blocks)

texts:
I created a module in Drupal 8 called Footer and made it a block so I can include it in my Footer region in my theme.

I need my footer to have two menus, one listing topics and one listing static pages.

I created a new menu in the Drupal admin, but I don't understand how I can include it in my footer.

I tried adding it to my footer region, but then it's rendered next to my footer, not inside it.

I tried creating a new region and include it in my footer twig template but it doesn't work, I'm not sure how to do it.

What would be the best way to do it? I can include code, I'm just not sure what you need to help me.

I manage to get the new region in my html.html.twig template using page.footer_page_links but the same thing doesn't work in my footer module's twig file.

More generally, I'm wondering how to nest blocks in my template files.