texts: Unable to save title after hook_form_alter()

texts:
I have a node form for a specific content type that has many fields.  I want to move these fields into field sets, and wrap that in a class to make it work with my theme.  I've done this with hook_form_alter(), and everything is fine, for the most part.  I am able to save fields, and the form is displayed correctly.

However, whenever I submit the node edit form, the title flips back to 'Array' and gives me the following errors:

Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen() (line 478 of mysite/includes/unicode.inc).
Notice: Array to string conversion in devel_watchdog() (line 531 of mysite/sites/all/modules/devel/devel.module).
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1565 of mysite/includes/bootstrap.inc).

Here is my implementation of hook_form_alter().  It's very simple; all it does is set up the fieldsets, copy the needed form elements into them, and then unset the original element:

/**
 * Implements hook_form_id_alter()
**/
function my_module_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'my_content_type_node_form':
      $form['fieldset1'] = array(
        '#type' => 'fieldset',
        '#title' => t('Fieldset 1'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#prefix' => '
',
        '#suffix' => '
',
      );
      $form['fieldset2'] = array(
        '#type' => 'fieldset',
        '#title' => t('Fieldset 2'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#prefix' => '
',
        '#suffix' => '
',
      );
      $form['fieldset3'] = array(
        '#type' => 'fieldset',
        '#title' => t('Fieldset 3'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#prefix' => '
',
        '#suffix' => '
',
      );

      //move elements into fieldset1
      $form['fieldset1']['title'] = $form['title'];
      unset($form['title']);

      $form['fieldset1']['field_origin_location'] = $form['field_origin_location'];
      unset($form['field_origin_location']);

      $form['fieldset1']['field_task_override'] = $form['field_task_override'];
      unset($form['field_task_override']);

      //move elements into fieldset2
      $form['fieldset2']['field_equipment'] = $form['field_equipment'];
      unset($form['field_equipment']);

      //move elements into fieldset3
      $form['fieldset3']['field_additional_troubles'] = $form['field_additional_troubles'];
      unset($form['field_additional_troubles']);

      $form['fieldset3']['field_resolution'] = $form['field_resolution'];
      unset($form['field_resolution']);

      $form['fieldset3']['field_repair_parts'] = $form['field_repair_parts'];
      unset($form['field_repair_parts']);

      $form['seperator'] = array(
        '#type' => 'markup',
        '#markup' => '

',
      );
    break;
  }
}

When I run a debugger and step through it at the time of the error, I see that $form_state['node']->title is set to 'Array', but otherwise I can't determine what is setting it to an array.

The error disappears when this form_alter function is commented out or the module is disabled, so I know that something within this function is triggering the error.

Does anyone have clues of where to start looking to solve this issue?  Is there, perhaps, some other thing that I need to do in order to move the form elements?  Maybe I am missing a step?  Or, is this maybe coming from another module's code and if so, is there a method to find that module?


texts: how to uninstall table associated with module for drupal 8

texts: I uninstalled drupal 8 migrate_example module but i still see the fields associated with migrate example module. How to remove it.


texts: I created a click-able image block and posted it on the left sidebar. A click made on the image leads to an external website. How do I count the number of clicks made on that image. The Google analytics don't seem to give immediate results. Is there any module for this. Any help is much appreciated.


texts: Using an aggregated entity query to find duplicate taxonomy terms

texts:
Due to a content migration bug, there are nodes in our site that reference the same taxonomy term multiple times with different deltas:

bundle  deleted entity_id   revision_id langcode    delta   field_term_target_id
article 0   1061    1062    en  0   307
article 0   1061    1062    en  1   307

I can find these with the following database query

SELECT
    entity_id, field_term_target_id, COUNT(*) as count
FROM node__field_industries
GROUP BY entity_id, field_industries_target_id
HAVING count > 1;

For building a tool that lists these nodes within Drupal, I would like to use an entity query instead of accessing the database directly.

I've tried the following:

\Drupal::entityTypeManager()
  ->getStorage('node')
  ->getAggregateQuery()
  ->groupBy('nid')
  ->groupBy('field_industries')
  ->aggregate('field_industries.delta', 'COUNT')
  ->conditionAggregate('field_industries.delta', 'COUNT', 1, '>')
  ->execute();

But this results in an error Invalid specifier 'delta'. If I aggregate on 'field_industries' instead (which seems wrong, as I'm already grouping on that value), I get completely wrong results back (specifically, vastly inflated values for COUNT, which can be as high as 16 even for nodes that are not affected by the bug).

So I guess my question is: How do I aggregate on a non-default column in the field table (such as the delta column)?


texts: Add the Form name to the theme suggestions input field

texts:
How do I get the form name to the theme a suggestion input in Drupal 8?

function [THEME_NAME]_theme_suggestions_input_alter(array &$suggestions, array $variables) {
  if (isset($variables['element']['#parents'])) {
    $suggestions[] = 'input__'.$variables['element']['#parents'][0] ;
  }
}


texts: Drupal 7: hierarchy disabled setting on taxonomy vocabulary

texts:
I would like to disable taxonomy hierarchy for a vocabulary.
In older versions of Drupal there used to be a setting on the vocabulary page:

  Hierarchy: disabled

Can do I achieve this with Drupal 7?


texts:
This morning i noticed that wherever i want to click on menu and above menu i have invisible links leading to spam websites.

It looks to me that they are hard coded but i have no idea where to delete them or how did hacker get access to my website. Was it through Drupal, or through server ftp or some other way. I have several websites on this server so i guess its possible that all of them are attacked.
Checking everything through drupal interface gives me no clue.

What steps should i do to prevent this from happening. Is there any way to find out when did this happen so i can maybe do server backup (websites are static so not much would be lost). Will it be enough to just change server/drupals passwords ?

Any help would be apreciated. Only thing i can think of right now is to put all websites in maintanance mode and wait for help.

UPDATE:
With hacked module i found that 4 files were changed:

includes/bootstrap.inc (no change there except 1 extra emtpy line at the end of document)

.htaccess (change is only in non www to www, which i did myself)

robots.txt (Crawl speed default line was removed, nothing else).

includes/theme.inc (here is the change, at line 2704, three lines added).

if($variables['classes_array'][1]=='front')

"$variables['page_bottom'] .= '<div class="_all_wplink_2CUJ7TnE_cc"style="position:absolute;left:0;top:0;opacity:0.001;z-index:10;filter:alpha(opacity=0)">Don\'t pump.... here comes bunch of links."

 if($variables['classes_array'][1]=='front')

Line 2 is huge and contains bunch of spam links. Easy to fix this but no idea how to prevent from happening again, how did hacker got access to server. Please advise.


texts: Is it possible to autoplay a video when using module media_youtube, and perform an action when the video ends?

texts:
I am using media_youtube module for embedded videos from youtube.
I am looking for a way to autoplay video as soon as it appears. Is it possible with this module?
Also I would like to make some action as soon as video ends. It would probably be going to some other drupal article. Is it possible?


texts: How can I have "Table view" as the default result instead of "Submissions“

texts:
When viewing the results page of a webform node, the submissions views is the default one.

We then have the possibility to display data using these secondary links:
Submissions, Analysis, Table, Download, and Clear.

I'm looking for a way to thange the order of these links.
I would like the table view to be the one displayed by default, instead of the submissions view.

The first part of the screenshot shows how the module works; the other half shows the order I would like for the tabs.


texts:
I have a site loading over https. However, two items are being picked up in Chrome as targeting http, and I can't figure out where to look to change them. They are:

GSS search form: we are using Google Site Search module, and it's
posting to http.
Drupal Views are posting to http, rather than https. Not sure how to
    override this.

Any help would be greatly appreciated. Thanks!


texts: Undefined error: 0 OR Unable to load autoload.php. Drush now requires Composer

texts:
I've installed drush in /usr/local/lib/drush/drush and composer in /usr/local/bin/composer.

When I try to run drush /usr/local/lib/drush/drush I get the following:

  /usr/local/lib/drush/drush: line 129: /Applications/MAMP/bin/php/php5.2.17/bin: is a directory /usr/local/lib/drush/drush: line 129: exec: /Applications/MAMP/bin/php/php5.2.17/bin: cannot execute: Undefined error: 0 –

OR the following:

  Unable to load autoload.php. Drush now requires Composer in order to install its depedencies and autoload classes. Please see README.md

What am I doing wrong? I'd like to install drush to use with MAMP if anyone has any suggestions. I've done through the readme and nothing seems to be working.


texts: How to grant create and update permissions to a custom role?

texts:
I have a new role as "Publisher". I want to grant Publisher 'create' and 'update' permission using code.

My .permissions.yml file looks like this :

'delete contact entity':
  title: Delete entity content.
'add contact entity':
  title: Add entity content
'view contact entity':
  title: View entity content
'edit contact entity':
  title: Edit entity content
'administer contact entity':
  title: Administer settings
'publisher contact entity':
  title: Publisher settings

I've used 2 functions to allow permissions.
The functions are:

 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// Check the admin_permission as defined in your @ContentEntityType
// annotation.
$publisher_permission = $this->entityType->getPublisherPermission();
if ($account->hasPermission($publisher_permission)) {
  return AccessResult::allowed();
}
switch ($operation) {
  case 'edit':
    return AccessResult::allowedIfHasPermission($account, 'edit contact entity');

  case 'update':
    return AccessResult::allowedIfHasPermission($account, 'update contact entity');
}
return AccessResult::neutral();  }

protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
// Check the publisher_permission as defined in your @ContentEntityType
// annotation.
$publisher_permission = $this->entityType->getPublisherPermission();
if ($account->hasPermission($publisher_permission)) {
  return AccessResult::allowed();
}
return AccessResult::allowedIfHasPermission($account, 'edit contact entity');   }

Now, If check sitename/admin/people/permissions, the role is created by it doesn't have a tick in the checkbox for edit contact entity.

PS: In @ContentEntityType, I've defined publisher permission as:

publisher_permission = "publisher contact entity"


texts: What are the recommended directory permissions?

texts:
I'm gearing up to deploy a Drupal 7 site and I can't find any documentation about what the recommended security-conscious file and directory permissions should be set to.

Specifically default/files/ (also sub directories?), settings.php, .htaccess and anything else I should be aware of.


texts: How to make a theme hook suggestion for menu according to region?

texts: I'm placing the same menu block in two different regions whereas different html markup for the list is needed. So analog to my previous question "How to make a theme hook suggestion for blocks according to region?" I need to know, how to get the current region inside the function MYMODULE_theme_suggestions_menu_alter, to add my own suggestion.


texts: I need to make a set of eight rules.  Each rule will have about ten actions, nine of which will be the same for each rule (basically, these rules will duplicate a node and change one field).  I would like to create a rule (sub-rule?) that contains the nine similar actions, and then make eight other rules which call the sub rule.  Is there a way to make a rule trigger another rule?  If possible, I would like to do this directly instead of performing an action (such as saving a node) which can trigger an event.


texts: hook_commerce_order_presave firing on page load

texts: I'm trying to run some code whenever an order is updated. I've found the function hook_commerce_order_presave which fulfils this purpose, but it seems this also fires on page load. Is this normal, or is there another module that would be causing this? Is there a more suitable function I could use?


texts: Inline Entity Form - How to change label for the EDIT button and REMOVE button

texts:
I try to modify the 'Edit' and 'Remove' label on the buttons displayed in the IEF table.
I can modify the 'Add new node' buttons with the code bellow

function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'CONTENTTYPE_node_form') {
    /*
    * Modify the Add node button when it's the first one
    */
    $form['MY_FIELD']['und']['form']['actions']['ief_add_save']['#value'] = t('CUSTOM TEXT');
    /*
    * Modify the Add node button when there is at least one node
    */
    $form['MY_FIELD']['und']['actions']['ief_add']['#value'] = t('CUSTOM TEXT');
  }
}

But I can't make it work for the Edit or Remove buttons

For the Edit button, I tried to add in this function:

$form['MY_FIELD']['und']['form']['actions']['ief_entity_edit']['#value'] = t('CUSTOM TEXT');

Doesn't work

$form['MY_FIELD']['und']['actions']['ief_entity_edit']['#value'] = t('CUSTOM TEXT');

Doesn't work either

Any idea ?


texts: Region with block shows up in admin preview, but not on site

texts:
I'm new to drupal and a bit confused by this. Using the standard Bartik theme (Drupal install 7.8) I see a search bar on the sidebar. Checking the Structure > Block it shows that the search is included in the Bartik theme on the sidebar. The preview while an admin shows the search.

However, as soon as I log out the entire sidebar_first region does not show. Just the content area.

EDIT: When adding a login box to the sidebar it does appear, however, the searchbar, and navigation do not. There are NO RESTRICTIONS applied.

EDIT2: View the screenshots below to see my settings.

Normal User sees:

Admin User sees:

Current settings for navigation block:


texts: Setting error text in Commerce Alter Form Module

texts:
I need to validate my form and return a specific error message if the terms of agreement checkbox isn't checked (it's a required field). So I've placed the following code in my CommerceAlter.module. However, it's not working (ie. the error text is still showing the default error text):

function CommerceAlter_form_validate(&$form, &$form_state, $form_id) {
  if (form_get_errors()) {
    $form_errors = form_get_errors();
    $drupal_errors = drupal_get_messages('error');

    // Clear form errors
    form_clear_error();

    foreach($drupal_errors['error'] as $key => $error) {
        if (in_array($error, $form_errors)) {
            // Unset form errors
            unset($drupal_errors['error'][$key]);
        }
    }

    // Rebuild drupal errors
    foreach($drupal_errors['error'] as $key => $message) {
        drupal_set_message($message, 'error');
    }

    // Validate form field and set error message
    if ( $form_state['values']['customer_profile_billing']
['field_i_have_read_and_i_agree_to']['und']['0']['value'] === 0 ) {

            form_set_error('value', t('You forgot to check the required
checkbox. Please try again.'));
        }
      }
    }

Any idea what I might be doing wrong here?


texts: Custom Module: db_select title AND body?

texts:
I'm a little confused by how the node data is stored in the database.  It seems like the title is stored in the db "node," while the body is stashed field_data_body, and custom fields are placed elsewhere.

I have create a custom module that pulls certain pieces of content, but I need to match up the title with the body.  I've been successful pulling my list of titles:

    function foo() {
      $query = db_select('node', 'n')
       ->fields('n', array('type','title', 'nid'))
       ->condition('type', 'fooBar')
       ->condition('status',1)
       ->execute();
          return $query;
      }
      $result=foo();
        foreach ($result as $node) {
         $id = $node->nid;
        }

How can I match each of these with their bodies?

Thanks!
-JB


texts: hook_menu wildcard auto-loader for webform submission?

texts:
In hook_menu() array keys, you can specificy wildcard tokens to autoload certain objects, such as %node to get the node object.

Is there a wildcard autoloader token for webform submissions? Some googling I've done has returned no results.

I've also grepped the codebase of the webform module for autoload, also to no results.


texts: How to use a field value in Template.php

texts:
Im sure this is an easy question, just not for me because of lack of experience with the Drupal preprocess hooks. I am removing the standard "Read More" links from my content. I want the ability to replace them with a css button. I can do that, the tricky part come when I want to use a FIELD from the CONTENT TYPE, as the name for the button.

function bootstrap_preprocess_node(&$variables) {

 unset($variables['content']['links']['node']['#links']['node-readmore']);

   $variables['newreadmore'] = t(' '.$readmoretext.' ',
   array(
    '!title' => $variables['node_url'],
  )
);
}

My question is how can i HOOK into the node and retrieve the field for my variable $readmoretext

Thanks!


texts:
I am trying to create a news content type which can display related content.

In the news content type I have an Entity Reference field with unlimited values, which is used to select the nodes which should be "Related" to the current node.

I have created a view and managed to get it to display all content which is "related" to ANY node with a content type of news using the relationship setting, but i can't manage to get it to display content related to a specific node.

What am I doing wrong? I can provide more info if I have missed anything.


texts: Upload image temporary and on form submit make it permanent

texts:
I have made a custom module where I load the create node form for an "announcement" content type.

What i want

Besides the text and select fields, I require an image field which supports multiple image upload (up to 4 ). The images should be uploaded to a temporary directory and load in the form a thumbnail for preview , and on form submit the images should be permanently saved . In case I refresh the form page , if I already selected the images they should still display on the form as thumbnails. After form submit I want to use the first image ( of the max of 4 uploaded ) as a preview image for the announcement and the rest to be shown when the node is viewed (using views module).

What I have

I made an image field with multiple values set to 4, I tried to hide the button for upload so the image is saved only on form submit, but I can't upload but one image on submit. If i leave the upload button , the user can click it , upload the image and do that for each image. But if i refresh the form page the thumbnails are not loaded at all, even though the files are saved on the server. After form submit I get all the images in the box for previewing instead of 1 .

My questions

Right now I am lost on how to approach these issues. I am not afraid to do this programmatically, but I don't know which functions should I look for, if i should keep the field and edit it or add the field programmatically and set its functionality as well. Or can this be solved by a few settings that I missed? Or is there a module out there that already did this so I don't have to reinvent the wheel?

Any help is most apreciated,if required I can attach the code for the module as well.


texts:
We have created a vocabulary with terms this way:

(main term A)
  |
  +-- subterm A1
  +-- subterm A2
  +-- ..
  \-- subterm A3

(main term B)
  |
  +-- subterm B1
  +-- subterm B2
  +-- ..
  \-- subterm B3

Easy right?

Then we've created "main terms" roles. Then we've used the taxonomy_access for those "main terms" roles. I.e. The rôle called main term A will only be allowed to create subterms of the main term A term.

Easy right?

Now we need reviewers. So we've "split" "main terms" roles in two:

"main terms A contributors"
"main terms A reviewers"
"main terms B contributors"
"main terms B reviewers"
...

And we've used the workbench module to give rights to contribute / or / review. The problem is that the rights given are not detailed enough: if you give "main terms reviewers" the right to "review", he/she is allowed to review all the "needs-review" nodes. Example: "main terms A reviewers" have the "review" right, so (like it is now) they have the right to review all "needs-review" nodes. We'd like them only to see/review only the nodes based on their roles: "main terms A reviewers" should only be allowed to review "main terms A needs-review" nodes. We could have used the workbench_access but this would implie create a section for each "main terms". This would kind of force us to duplicate all our "main terms" into "sections" then give "sections" right.

How would you do?

Maybe there's another possibility: the workbench tab is a view. So maybe it could be possible to add a filter based on the taxonomy access control, but it seems that taxonomy access control has no api, and we should have to create a manual join. Maybe there's a way to create a fully customized join based on the taxonomy access control? If so, may I ask how you would do this?

If you think I'm not on the right track, don't hesitate to give me your solution!

Thank you!


texts: How do I customize a Superfish Menu for Drupal 7?

texts:
I have successfully installed Superfish by installing the Libraries module, downloading the Superfish library and putting it in /sites/all/libraries, and installing the Superfish module.

Now I would like to customize the look of it. The pre-built styles that show up in the drop-down in the Superfish Configuration could be a decent starting point, but I really would like to get into the details and get the measurements and colors just right.

How can I do this?


texts: Views, Taxonomy, multiple parameters using contextual filters

texts:
A view has been created to display related content types via their taxonomy terms, using contextual filters.
Currently the view is able to display content based on the first param  eg. about
The goal is to abe to display content based on the second param, being the child term and hide the parent eg. about/meet-the-team.

Here is a break down

Url :    page/parent term

parent term
    Content item referenced to parent term
    Content item referenced to parent term
    Content item referenced to parent term
    Content item referenced to parent term

Url: page/parent term/child term

child term
    Content item referenced to child term
    Content item referenced to child term
    Content item referenced to child term
        Content item referenced to child term
    Content item referenced to child term

Url: page/parent term/child term/child child term

Content item referenced to child child term
Content item referenced to child child term
Content item referenced to child child term
Content item referenced to child child term
Content item referenced to child child term
Content item referenced to child child term
Content item referenced to child child term

And this will continue on

Eg Url: page/parent term/child term/child child term/child child child term/child child child child term.


texts:
Is it possible to set a Views 3 path for a page to %/% instead of, for example, factsheets/%/% ?

The preview works, but the actual view doesn't.  I'm thinking it shouldn't, but can't find anything to confirm one way or another.


texts: Ho to add mixed multiple fields in a node

texts:
I'm searching for a way to add unlimited amount of multiple mixed fields in a node.

In few words there is such a situation: let's say, I have a content type with fields "picture" and "text", and for both of them "number of values" is set to "unlimited", which lets user to add unlimited amount of photos and unlimited amount of text blocks.

What I want to achieve is that content editor could mix those two fields together, like it is possible to change places of entries of one field. The example of entry could be like this:

editor is adding a block of text, then a picture, then another picture, then again a block of text, etc.

The problem is that it is not clear what could be the amount of these elements and their sequence may change depending on circumstances.

I know that it is possible to do this with Views, but that makes the work of editor much more complicated and he/she cannot see the "full view" at the same time, so maybe it is possible somehow to merge two types of fields?


texts: Problem with "content access" (module) and permission "View own unpublished content"

texts:
I have a problem since few days and i didn't find my answers.

When i install content access, the permission View own unpublished content doesn't work anymore.

Some explanation about my configuration:

I use workbench and workbench moderation to create a simple workflow (i didn't change any setting: so draft, in review, published)

I have 2 roles who manage all the content (editor, manager and another role admnistrator who has all the bypass etc.)

And now, i've juste discovered that i have a problem when i need to see nodes that are not published. Editor and Manager can't see them event if they have created this content.

They can't see unpublished content everywhere in the site (in workbench administration and in content section so it's not a views problem)

I made another installation in local to make some test. I re-created my role with a basic configuration (permissions):

Access administration menu
Access the content overview page
View own unpublished content
View the administration theme

So when my manager creates a content type and it's unpublished it works fine. But when i install content access, it doesn't work anymore.

I don't know what's going wrong in my site but the only way for the user to see unpublished content is to have that permission : Bypass content access control

Problem, if i give them that permission, an editor can published content. It's override the workbench permission (he can just use draft and in review, only manager can published)

The only setting for content access i saw are in the content type section.

I think i made a stupid mistake, forget a setting but i didn't see where.

Thxs for your help :)


texts: Form wont submit using AJAX when logged out

texts:
I am trying to submit the Add To Cart form using AJAX, I have altered the form like so:

function ajaxcart_form_alter(&$form, &$form_state, $form_id) {

    if(strstr($form_id, 'commerce_cart_add_to_cart_form_')) {

    // Process the submit button which uses ajax
    $form['submit']['#ajax'] = array(
       'callback' => 'ajaxcart_submit_callback',
    );

    // dpm($form);

    }

}

Call Back Function

function ajaxcart_submit_callback($form, $form_state) {
  global $user;

  $form = drupal_rebuild_form($form['#form_id'], $form_state, $form);

  $commands = array();

  $commands[] = array('command' => 'ajaxcart_update') ;
  $commands[] = ajax_command_prepend('#block-system-main', theme('status_messages'));
  $commands[] = ajax_command_replace('.' . drupal_html_class($form['#form_id']), drupal_render($form));
  $commands[] = array(
    'command' => 'ajaxCartFireTrigger',
    'data'    => $form['#form_id']
  );

  return array('#type' => 'ajax', '#commands' => $commands);

}

I have done a dump of the form and the ajax attribute has been added to the submit button. Problem is it will not work on the frontend while logged out. If I am logged in it works just fine and shows the throbber etc. beside the button.

The strange thing is, that it will work occasionally after the product has been added to the cart via the normal page refresh. To me its like it is missing the AJAX behaviors or something. Also while logged in, the button has the class 'ajax-processed' added, whereas it doesn't if not.

I have compared both and I cannot see what is wrong. Anyone got any suggestions to the problem?

Thanks
Robert


texts: I have few existing node nodes which contains link Click here. Now I want to update all links to . Is there any way to do this in Drupal8 via code.


texts:
I currently have two node types: Album (CCK), and Image (image module, using Image FUpload module).
A user creates an album, simply a title. When they create Image(s), the album is node-referenced.

I have a view of Albums, and I would like to pick one Image from each album to show as a cover photo. I cannot just add a CCK field to the Album for this; the image needs to appear in the view of album images, and every image can be voted and commented on, as well as have their own references (tags).

I tried a few relationships in the View, nothing seemed to pull the image for an album. Is this possible using the Image module?


texts: Manipulating Theme Suggestion Priorities

texts:
I'm adding in some theme suggestions using mytheme_theme_suggestions_alter(), when certain criteria is met. My issue is, for some reason these additional theme suggestions are appearing at the top of the theme suggestions list whilst debugging.

Basically my theme suggestion is ignored, as Drupal believes my additional theme suggestions aren't a priority over the default ones.

<!-- FILE NAME SUGGESTIONS:
   * views-view--venues-grid-rows.html.twig
   x views-view.html.twig
-->

I've tried some 'dirty' solutions, such as trying to clear or reverse the $suggestions[] array without any luck.

My guess is that the hook I'm using is actually running too early, however I'm unable to find a more appropriate one. Something dedicated to hooking into view theme suggestions would be great.

Thanks in advance.


texts: Move fields into fieldset with field_collection module doesn't work

texts:
I have a node, inside this node I have a field_collection with one checkbox and 2 fields inside it. I want to move these two fields inside a fieldset to show/hide entire fieldset depending of the checkbox value.

function mymodule_form_testtype_node_form_alter(&$form, &$form_state, $form_id) {
    $form['field_test_collection']['und'][0]['surround_fieldset'] = array(
        '#type' => 'fieldset',
        '#title' => t('Sorround fieldset'),
        '#tree' => FALSE,
    );
    $form['field_test_collection']['#tree'] = FALSE;
    $form['field_test_collection']['und'][0]['surround_fieldset']['field_collection_first'] = $form['field_test_collection']['und'][0]['field_collection_first'];
    $form['field_test_collection']['und'][0]['surround_fieldset']['field_collection_second'] = $form['field_test_collection']['und'][0]['field_collection_second'];
}

But when I try to submit the form these two values are not saved. I tried to remove the original fields using

unset($form['field_test_collection']['und'][0]['field_collection_first']);

or hide them with

$form['field_test_collection']['und'][0]['field_collection_first']['#access'] = 0;

I also tried the "cheat" to move back these two fields in the validate function

function mymodule_article_form_testtype_node_form_validate(&$form, &$form_state) {
    $form_state['values']['field_test_collection']['und'][0]['field_collection_first'] = $form_state['values']['field_test_collection']['und'][0]['surround_fieldset']['field_collection_first'];
    $form_state['values']['field_test_collection']['und'][0]['field_collection_second'] = $form_state['values']['field_test_collection']['und'][0]['surround_fieldset']['field_collection_second'];
    unset($form_state['values']['field_test_collection']['und'][0]['surround_fieldset']);

    $form['field_test_collection']['und'][0]['field_collection_first'] = $form['field_test_collection']['und'][0]['surround_fieldset']['field_collection_first'];
    $form['field_test_collection']['und'][0]['field_collection_second'] = $form['field_test_collection']['und'][0]['surround_fieldset']['field_collection_second'];
    unset($form['field_test_collection']['und'][0]['surround_fieldset']);
    $form['field_test_collection']['und'][0]['field_collection_first']['#access'] = 1;
    $form['field_test_collection']['und'][0]['field_collection_second']['#access']  = 1;
}

With a dpm($form_state) in the submit function I can see correct values in their places, but after it they're not saved.

Any idea?
Thank you


texts: Missing five core module folders and one enabler

texts:
In Drupal 7.36, the "Administration > Modules" page (/admin/modules) lists 44 core modules. However, the folder "...\htdocs\admin\modules\" has subfolders for 40 modules, which include those 44, except Field SQL storage, List, Number, Options, and Text, plus Profile.

In other words, there are five core modules that do not have a folder in the core modules folder and there is one core module (Profile) that is not available for enabling on the "Administration > Modules" page.

Does anyone here know why that is?

The Profile doc page says to "enable in admin/build/modules". That URL on my installation just takes me to the main Administration page. So how does one actually enable this module?


texts: Circular Search view not returning results if city exists in UK AND elsewhere

texts:
We have a locational search (using circular search filter in the View) available for our member groups across the UK: https://makingmusic.org.uk/resources/find-a-group-list

Entering cities/towns by name such as 'London' returns results correctly, but where there is a town/city with the same name abroad (e.g. 'Durham' or 'Cambridge' which both also exist in the US) no results are returned unless the country is included: 'Durham, UK' or 'Cambridge, UK'.

Since the search should only cover the UK (and so there shouldn't be a conflict caused by a place name existing outside the UK) is there a setting where I can limit the search criteria so that it only looks for places in the UK (and so doesn't get stuck where the name appears somewhere other than the UK as well)?


texts:
I am working on data migration from old site to new site.

Which module i can use for data migration. I am stucked in the issue that fields are not same in the old site and new site. How can i map fields so data can be migrated from old site to new one.

Issues that i am facing:-

1) In old site there are lot of content types and new site there are few. Because fields are managed to merge in few content types.

2) Fields name are not same exactly same like the old site.

3) Few of the fields are converted into taxonomies.

4) Old site contain lot of data as well as images.

So is there any drupal module that i can use or i need to follow some other approach?

Please suggest me some solution.


texts: Why does the core search module not index node titles?

texts:
The search results only show terms in the body if that. Take the example of a product site. There is a product called Funkywidget with a description that has Funckywidget written twice in it. However, the core search module does not show any results for Funkywidget. It has a record in the search_index table but doesn't show when typed into the search form.

What is the best way to enable people to find a Funkywidget?


texts: Assign content automatically to specific user

texts:
I added a new roles - technical support and management. Added several user to that role.

Created new content type called Claim Report contain fields ( title, body, area ).

What I want to achieve is, when authenticated user create new content claim report, select specific area and save, it will automatically shown to specific technical support user account sort by area.

Ex :

techspp1 - area 1

techspp2 - area 2

techspp3 - area 3

When authenticated user create content and choose area1, that specific content only shown in techspp1 account page, choose area2 shown in techspp2 account page only.

Then techspp1 reply / give solution and the user claim content get updated with that solution and get status solved / on-progress.

Can anyone help ?


texts: How to set the image as a background using Url to Image formatter?

texts:
We have a need to set an element such as
 to have an image as a background. I am trying to figure out the way to get the image to display as a background but also with the image style that was used.

The image field (field_image) in question is used in multiple view modes with different image styles.

Example:

Basic page view mode: default, field_image with format = image and image style = large
Basic page view mode: promoted, field_image with format = image and image style = small
Basic page view mode: small tile, field_image with format=image and image style = medium

How can I accomplish the code below? Would the proposed solution work as I am not sure it is safe to use ['#markup']?

Currently on View mode:

Field_image with Format = Image, Image Style = large

Current problem:

node.field_image.entity.uri.value returns the original images, not the one where the image style is applied.

Proposed solution:

set format = URL to image
image style = large
update the twig template to use node.field_image.0['#markup]


texts: i have prepared form api, now how to insert form values when i click submit button by using db_insert

texts:
I have prepared a form using Drupal form API. Now how can I insert the form values when I click the submit button by using db_insert()?

$form['totp'] = array(
    '#title' => t('Title of the Programme'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#maxlength' => 250,
    '#size' => 50,
);

$form['pd'] = array(
    '#type' => 'radios',
    '#title' => t('Programme Day'),
    '#required' => TRUE,
    '#options' => array(
        0 => 'One Day Programme',
        1 => 'Two or More Day Programmes'
    ),
);

The above values to be stored in MySQL table?


texts: how to create next and previous month menu link in calendar in drupal 7

texts:
how to create next and previous menu link in calendar in drupal 7

  Next month >>                              << Previous month

             ---- calendar area ----


texts: Flag the inappropriate content and not allowing people to add a content?

texts:
I have added a content type called "share", I have given the user permissions for this content type, meaning he can add the content and he can share to any one..

If any user feels that the content is inappropriate, he can flag the content accordingly.  If a piece of content is flagged 3 times, the content is automatically unpublished.. I have done this using the Rules module...

But here what I want is if a user's content is unpublished as "inappropriate", the next time he should not be able to post any content but he can still access the site.

How can I accomplish this?


texts: Checking for an empty entity reference field in hook_node_validate

texts:
In checking whether a form field contains an entry, it has been typical to do something like:

if (sizeof($form_state['values']['my_field'][LANGUAGE_NONE]) > 0)

because an empty field would still be an array, but an empty one. With entity reference fields, an empty field looks like:

$form_state
  values
    my_field
      und
        0
          target_id=''
          add_entityconnect_my_field_0_ = "New content"
          edit_entityconnect_my_field_0_ = "Edit content"

so that testing for the empty array fails. One could check to see if the target_id is empty, but I'm wondering if there's a way to test the form field for empty without needing to go down to that level.


texts: How do I create a "More like this" block?

texts:
Is there a way to create a "More like this" block with the Views, and the Search API Solr modules?
I saw this, but it doesn't work.


texts: Repeat view entry for each value of multivalue field

texts:
I am using commerce module in D7. Each order can have a single line item, but you can have whatever quantity you like in that line item. For each item of this quantity I store a text value that is held in a multivalue text field on the list-item itself.

So you have:

  Product 1  Quantity 1 Price $10  Information: Item1Text

  Product 2          Quantity 3     Price $10 Information: Item1Text, Item2Text, Item3Text

I would like to have a view for each order to display each item of the line item as a separate entry. So for example:

  Product 2           Price $10           Information: Item1Text

  Product 2           Price $10           Information: Item2Text

  Product 2           Price $10           Information: Item3Text

Is this at all possible, because I have tried all the tricks that I know, but cannot produce such a view.
The reason I need something like this is that I can have a separate invoice for each of the items included in the order, besides them being purchased together. So if you buy 3 balls, I would create 3 invoices each describing the purchase of a single ball.


texts:
I need to pass some URLs to user pictures via AJAX. I can't, however, pass private://filename.jpg because client can't open it.
Are there some settings to configure where I can change to public space?


texts: How to get menu tree from a node to build a customize breadcrumb?

texts:
I would like to build a custom breadcrumb based on node relation from entity reference. For example there is a book node that has menu hierarchy:

Book
|-chapter 1
|--sub chapter 1.1
|---sub sub chapter 1.1.1
|----#Node with different content type and not included/displayed on Book
      Navigation

The Page Node (sub sub chapter 1.1.1) has entity reference relation with node biblio (for ex)

What I want is when I access biblio then the breadcrumb is displayed like the above tree.

Possible solution:
Write a code using nexus theme on template.php on function:

function nexus_breadcrumb($variables) {

  //$breadcrumb = $variables['breadcrumb'];
  //$node = $variables['node'];

  if ($node->type == 'biblio'){
   // pseudo code start
   // get 'book' node that point to biblio
   // get menu tree from the book node
   // construct the menu tree and assign it to $breadcrumb

   // this is I still not know how to code the section.
  }

  if (!empty($breadcrumb)) {
  // Use CSS to hide titile .element-invisible.
  $output = '
' . t('You are here') . '
';
   // comment below line to hide current page to breadcrumb

  $output .= '' . implode(' » ', $breadcrumb) .
   '';
   return $output;
  }
}

Any help will do. Thank you.


texts: How do I print line breaks and HTML in a watchdog message?

texts:
I am trying to log emails to watchdog for testing in my local dev environment.

function MYMODULE_mail_alter(&$message) {
  // First: Prevent the mail from being sent.
  $message['send'] = FALSE;

  // Next: Log the mail so it can be debugged if necessary
  ksm($message);
  $logemail = $message['subject'] .'\nThe following email was not sent: \n
Subject:
' . $message['subject'] . '
Body:
'  . $message['body'][0] . '
';
  watchdog('MYMODULE', '@logemail', array('@logemail' => $logemail), WATCHDOG_ALERT);
}

However, this gives me a value for Message that doesn't have any line breaks and ignores my HTML
 and \n:

Patrick K, new members for the week of April 23\nThe following email was not sent: \n
Subject:
Patrick K, new members for the week of April 23
Body:

Dear Patrick K,

We haven't seen you in awhile. Hundreds of people have joined since you last logged in.

Log in now and say hello to our newest members!

How can I get the line breaks and HTML to be rendered in the watchdog message?


texts:
I am using:

Drupal 8.8.8
Open Social 8.4
Profile 1.1
Flag 4.0-alpha3

I am using the Open Social module which uses profiles and have added a flag to users called “Follow User” (Machine name: follow_user).
I want to show this field on users profiles, so other users can follow users.
How can I display a user field on a profile?


texts: How can I achieve basic authentication in Drupal?

texts:
I am trying to get working webservices in drupal (Services, restws,...), but ,as a first step I am trying to get a cookie using 'Basic Authorization' using the following python script:

import urllib2
import base64

def login(u,p):
    url = 'http://127.0.0.1/drupal/node?destination=node'
    r = urllib2.Request(url,None,{'Authorization':'Basic '+base64.b64encode(u +':' + p),
                                  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                              'Accept-Encoding': 'gzip, deflate'})
    f = urllib2.urlopen(r)
    cookie = f.headers.dict['set-cookie'] # <--- this fails, raises exception
    csrf = f.read()
    return csrf,cookie

csrf, cookie= login('username', 'password')
print base64.b64encode(csrf)
print "cookie:", cookie

The line 'cookie=f.headers.dict['set-cookie']' fails, since there's no cookie returned in the response.
What could I have  missed ?


texts: Is there a CCK field where I can add a link to a file, not an upload but something that will save the link as a URI.


texts: Is there a downside of having too many features?

texts:
I have worked on or seen different D7 projects in the past, with different strategies for features:

One feature per view, content type, etc, with a consistent naming pattern. The result is many features with small or medium size. This has been my personal preference in the past.

Examples:

mysite_ft_vw_articles, for an "articles" view.
mysite_ft_ct_event, for an "event" content type.
mysite_ft_tx_categories, for a "categories" taxonomy vocabulary.

Multiple elements grouped into the same feature, e.g. if they are related to a specific section of the site, a specific topic etc.

I am now in a new project where we have to pick the strategy we want to follow, and some team members prefer to have bigger features with more elements in them.

To me the only problem I can imagine with having too many features would be performance. Some operations in Drupal may get slower if more modules are enabled.

The main problem with less but bigger features would be git merge conflicts, and side effects of "drush fu" on unrelated functionality.

Question

Am I missing something?

How big could the performance or memory impact be for e.g. 300 enabled feature modules?

What other downsides would it have?

Is there a recommended way / best practice?

Related

When using features to manage deployment, should I break my functionality into many little features or one big feature?

This question is asking whether to have multiple features or one big feature. But the accepted answer still suggests to group a lot of things into one (e.g. all content types, all views, etc).

I am asking whether to have multiple features, or even more features.

Note: the sites where I did this so far had fewer content types and views, so if there was a performance impact it would have been smaller. Also I have not compared few or many features on the same project to see which is faster. This is a new employer, new team, new project, I want to do things the way I used to on other projects, but want to evaluate the pros and cons and have a good argument, before I force this on a team that used to work differently in the past.


texts: How to convert a stdClass object to a SimpleXMLElement object

texts:
I have a JSON file from a web service and want to use this data with a Drupal module. However, this module expects XML data. So I have the idea of overwriting the module. To do this, I need to convert the JSON file in XML, and ensure the file changes from JSON to PHP array.

Does any method or library exist to do this or convert .json file to .xml directly?

Now I have an array that is like the following one:

Array(
  [0] => stdClass Object(
    [sponsor] => stdClass Object(
      [created_at] =>
    )
  )
)

I need to convert this array in:

SimpleXMLElement Object(
  [@attributes] => Array(
    [type] => Array(
      [sponsor] => Array(
        [0] => SimpleXMLElement Object(
          [created-at] =>
        )
      )
    )
  )
)


texts: Is there a way to setup a site monitor on drupal?

texts: I have the current question: https://drupal.stackexchange.com/questions/37712/ubercart-items-wont-add-to-cart-unless-cache-is-cleared. In order to try and narrow down what the issue is. I'm curious if there is a way to setup a sort of monitor or logs to be able to get some more insight as to what is going wrong. I know of the typical status reports, Log messages & server logs. But is there anything that might be able to give me more drupal related details?


texts:
I need to translate the Label of the panes in a page. For example, Title and Body are not translated in my pages.

Note: I do not mean the content of panes! I only mean their label! Which is generally called TITLE.


texts: FACETS : Add "Apply" button that will apply all filters in one query

texts:
Is it possible in D8 to add an "Apply" button that will apply all facet filters in one query and not having an ajax reload on each option changed ?

i find this for D7 :

https://www.drupal.org/project/ajax_facets/issues/2700063

i am not quite sure  what's been the issue of that issue.


texts: Slideshow does not work in Safari or Chrome

texts: My slideshow block works in Firefox, but not in Chrome, Opera, or Safari. In these browsers, I just get the controls with no images. Note that the View page (attached) also dopes not show the image the preview in the other browsers.


texts: Custom configuration forms: translation access denied

texts:
While creating custom configuration forms, I'm getting an access denied. But on the /translation page of the form only. Configuration form itself can be reached, filled and updated without problems.

Configuration does show up on the admin/config/regional/config-translation page but can't be translated for some reason.

Any idea's?

Overview of files:

schema.yml

faq.settings:
  type: mapping
  label: 'FAQ settings'
  mapping:
    faq_title:
      type: text
      label: 'Title'
    faq_text:
      type: text
      label: 'Text'
    faq_cta_label:
      type: text
      label: 'CTA label'
    faq_cta:
      type: text
      label: 'CTA'
...

routing.yml

aform.faq:
  path: '/admin/config/aform/faq'
  defaults:
    _form: '\Drupal\aform\Form\faqForm'
    _title: 'FAQ block'
  requirements:
    _permission: 'administer site configuration'
...

config_translation.yml

aform.faq:
  title: 'aform FAQ'
  base_route_name: aform.faq
  names:
    - faq.settings
...


texts:
I used Bulk Export to export all my Context definitions into my module in a function that implements hook_context_default_contexts().  However, my default context definitions do not appear if I delete the ones in the database.

Does this hook no longer work in Drupal 7?


texts: Kint works in pre_process but not in Twig

texts:
On my site, I'm able to use print variables using kint in my pre-process functions.

However, when I try to do the same in twig, nothing happens.  I do have debug mode turned on.  Has anyone ever ran into this fact pattern? Any ideas?

To clarify:

It does not work in any of my templates
The specific template I'm using is for styling the output of a view, which is a page and has unformatted HTML as its type.

This is how I use kint  kint()

This is what I have seen on tutorials.


texts: Change .gitignore file for sites/default/files/config

texts:
I'm checking out the new configuration management module for Drupal 7. It's effectively a back-port of the new configuration management that's in D8, and looks like it's going to be a great alternative to the use of Features for storing configuration.

https://drupal.org/project/configuration

I have a test github repository where I'm playing with the module. I'd like to put my code and configuration in this repo, and I'd quite like to keep the default location for the config files (sites/default/files/config).

I realise that this is more a question about .gitignore files than Drupal. However, how can I change my .gitignore file so that I can add the config files to my repo?

The current gitignore is here. (This is the excellent .gitignore file provided by github as a default for Drupal projects).

The simple change of adding !sites/default/files/config/* to the end of the file doesn't seem to help.

EDIT: I also tried this, with no luck:

!sites/default/files/config/*.inc

I'd be grateful for any tips on how others manage to solve this problem. Thanks!


texts: Auto tagging when using entity referencing

texts:
I use the Entity reference module to link nodes of different content type to each other. In my case, node (A) references node (B).  B can be referenced by multiple A. Both A and B are tagged by the same taxonomy vocabulary. A is only tagged with one term.

I would like to automatically tag B with the same taxonomy term as A. How can this best be achieved?


texts: Generate PDF with wkhtmltopdf after batch finished

texts:
I would like to generate a pdf with wkhtmltopdf at the end of my batch.

I integrate the generation in the callback function but it does not offer me the download of the file

This is my finished function:

function csm_generate_pdf_finished($success, $results, $operations) {
  $message = 'some errors';

  if ($success) {
    if (($library = libraries_load('phpwkhtmltopdf')) && !empty($library['loaded'])) {
      $pdf = new WkHtmlToPdf();
      $html = $results['data'];
      $start = $results['start'];
      $end = $results['end'];
      $pdf->addPage( $html );

      $filename = 'document_'.$start.'_'.$end.'.pdf';

      $pdf->send($filename);

      $message = 'Generation PDF ok';
    }
  }
  drupal_set_message($message);
}


texts: extracting data from specific content type

texts: I have an old site developed with drupal 7 and now I have created a new site (with new template) with drupal 8. I want to extract a specific content type data and restore in the new site. suppose I have a content type called Academic and I want to restore it on the new site. Is it possible to do that automatically, because it has more than 1000 contents. Any help would be appreciated. Thanks in advance


texts: Load and render all pages from main menu

texts:
I'm trying to create a one-pager website in which I'd like to get all the main-menu links and load their complete content underneath each other on the homepage. So that's blocks, display etc. in all.

So I was thinking I could just get the page and render it in an each link; but I can't figure out how I can load and render multiple pages in one go.

I make a preprocess_page hook and got the menu links I want. How do I go about and get all those pages underneath each other now?

function myproject_preprocess_page (&$vars) {

    //Get ALL The pages from the main menu and ALL the content
    //And make one large content for all of it to create a one-pager
    if (isset($vars['node']) && strtolower($vars['node']->title) == "home") {
        $menu = menu_tree_all_data('main-menu');
        if ($menu) {
            foreach ($menu as $menuItem) {
                $a = menu_get_item($menuItem['mlid']);
                //echo render ($a); // Gives nothing
                //echo drupal_render_page($a); //time-out
            }

        }

}

}

I also tried with menu_load_links but I can't really see if I'm extracting the node now and how to render that.

$menu = menu_load_links('main-menu');

if ($menu) {
    foreach ($menu as $item) {
        $b = menu_get_item($item['link_path']);
    }
}


texts:
I have  view that displays a users nodes. When you view "my account" it displays all the nodes you created in a view.  However when viewing another user's profile, you don't see the node's that they added, instead you still see your nodes.  Is this something I would need to set up with views and rules?

tl;dr How can I create a view that displays user specific content on their own profiles.

X user's content on X user's profile
Y user's content on Y user's profle

EDIT
Answer:
Drupal 7 views, filter by owner


texts:
I want to open same page from different contents. So I need to generate link like /testimonials#group-1 for these contents. I used pathauto module for this. I made pattern for this category testimonials#[node:title]. But this URL get encoded by browser /testimonials%23group-1 and it gives me no page found error.

So how can I put anchor (#) in URL alias which can give me output like /testimonials#group-1.?


texts: How to check if drupal_get_messages() returns an empty array

texts:
I am running drupal 6.22 with MySQL. I am trying to check if there is any error message set by using the following If statement, but with no luck.

if(count(drupal_get_messages('error',FALSE)) > 0){
...
}

When I try this condition, I get a parse error saying...

Parse error: syntax error, unexpected T_IF

What am I doing wrong here? And how do I check if there is any error message in the message queue?


texts: How do I add a customer ID field in Ubercart?

texts:
I want to ask for the customer to enter his ID when he buys something.
Is it hard to add a new field apart from the default: name, phone, address, etc?


texts: Add more fields to content type dynamically

texts:
I am looking for the ability to let the user who is creating the page add more fields to the node rather than the entire content type.

For example if I had a content type called Book and each content type I wanted the user to select how many authors the book had. Some books might have 5-50 authors. It does not make sense to be to create 50 fields in the content type, id rather let the user select how many author fields they will need with an "add more" button.

In my case I am using videos and the Brightcove video module that adds a custom field to my content types. I figured the process would be the same. What is the best way to create this add more experience?


texts: Allow anonymous users to subscribe to newsletter/mailing list

texts:
My aim:
Client side: Have a block in the front page to allow any user (including anonymous users) to input their names and email addresses to subscribe the newsletter. Administration Side: being able to see the mailing list and send out newsletter to these emails.

What I have got:
I downloaded and enabled the follow modules: Mail System, Mime Mail, Mime Mail Action, Mime Mail CSS Compressor, Simplenews, SMTP Authentication.

I am using Drupal 7 with Bootstrap theme.

What I have done:
I have added a new simplenews block in the front page only, styled a little bit. In permission section, I ticked both ANONYMOUS USER and AUTHENTICATED USER for 'Subscribe to newsletters' option.

Problems:
I input my email and clicked the subscribe button in the block as a anonymous users, there is an error:

  Unable to send e-mail. Contact the site administrator if the problem persists.

Followed by a notice:

  You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription.

The SMTP Authentication module doesn't work for my account because it said my php doesn't have ssl enabled, which I don't know how to do? I have enabled ssl module in my apache, but what shall I do next?

Also I then see no subscribers added when I log on as an administrator later.

Question:
How can get let anonymous subscribe to mailing list and how can I create newsletter? Any instructions on how to achieve this? Am I using the wrong modules?


texts: Drupal 7 connection to MS SQLServer/PostgreSQL

texts:
I'm building an architecture of an integrated system of databases that are going to be the infrastructure of about 60 websites.

since databases are going to be massive (more than 30000 articles will be inserted in the database, thousands of books and its abstraction and etc) I'm really worry about the efficiency and ability of MySQL to handle the data.

I'm not very experienced in the theory of Database Management System, so this is my question, Can MySQL handle this amount of data? if not Can Drupal 7 connect to MSSQL Server and work with it as good as it works with MySQL? what about PostgreSQL?

Thanks


texts:
I am writing a script to delete 200+ users. To achieve this, I write a db_select query and got all the UIDs. The I wrote foreach loop to delete users using 'user_delete' function. But this is taking lot of time to delete a single user. It will be very hard to delete 200+ users.

Can someone help me to solve this program to delete bulk users programmatically?


texts: How do I override the "This image has been removed" message?

texts:
I'm using Drupal 8.0.0-beta10. I just tried to add a new basic page node that contains an image hosted in an external website: While it's showing up in the preview, the image isn't showing up once the node is published; when I hover over the broken image, it shows the following message.

This image has been removed. For security reasons, only images from the local domain are allowed.

How do I override this?


texts: How can I dynamically change the display format?

texts: I have an entityreference field. I want to change the 'Format' under 'Manage Display' from 'Rendered Entity' to 'Label' based on custom logic. Basically, what I'm doing is, if there isn't an image in a node (field_image), it will load a default image from the taxonomy term. If there is an image in the node, it will just display the label. Sorry if this has been answered, but I can't find anything on it. I've tried hook_entity_view_alter, but I don't think that's the right one.


texts: Nice Menus - Root links expanded by default - How to collapse?

texts:
This is my first time using Nice Menus with Drupal 7. I have created a test menu that contains four links. I have placed this menu in a custom region within the header of my site. When the page displays the links of the menu are all displayed one underneath the other vertically. I had expected the menu to be collapsed by default such that the user would have to mouse over the menu title before seeing the menu items (in this case, the four links) displayed.

I cannot seem to find a settings to make the menu "collapsed" by default. I had the Nice Menu settings set to display zero children (set to 0) thinking that might be it but still no luck. Has anyone else run into this problem? Do the links at the root of the menu always display expanded?


texts: How do I add a class to the search block form?

texts:
I want to add a class to the <form> element on the form_id 'search_block_form'

this is my current code

function THEME_form_search_block_form_alter(&$form, &$form_state, $form_id) {
  $form['#attributes']['class'][] = 'form-inline ';

}


texts: How do I install on Ubuntu 20.04 (LAMP)?

texts:
I have Ubuntu 20.04. I installed Apache2 and MySQL 8 on it, but I can't install Drupal 8. When I try to add the database information like usual, I get the following error message.

I traced the possibilities of the error and be sure of solving it, but it still doesn't work. I didn't find instructions on the net to work on it.


texts: What is incorrect with this HOOK_node_presave method ?? Trying to modify a FAPI textfield

texts:
/*
 * Implements hook_node_presave()
 */

function custom_kca_node_presave($node) {
    drupal_set_message('DEBUG: PRESAVE Called');
    if ($node->type === 'product') {
        $node->field_product_short['und'][] = 'test';
    }
}

I created a custom textfield called field_product_short on the product Content Type.

A krumo check on $node after saving reveals $node->field_product_short to have the following:

field_product_short (Array, 1 element)
    und (Array, 1 element)
        0 (Array, 1 element)
            value (String, 1 characters ) t | (Callback) t();

?!? I'm setting it to a string in my HOOK. Why is it setting it to a value only of 't' with a callback t(); method? Shouldn't it just be reading:

field_product_short (Array, 1 element)
    und (Array, 1 element)
        0 (Array, 1 element)
            (String, 4 characters ) test

What am I doing wrong?


texts: Execute drush command against against multiple groups

texts:
We have a large set of Drupal instances, and we use Drush alias groups to group them logically. For example, we have a group "dev" for all sites "in development", and, for example, another called "7_36" for all on Drupal core 7.36.

I can currently run commands against all sites in a single group (drush @dev status), but is it possible to run a command against all sites which are in both groups? For example, I'd like to run a command against all sites found both in @dev and in @7_36.

Is this possible?


texts: I am looking out to change the message displayed after user registration submits the user details. Is there a module to achieve it, or do we need to hard code the message to display?


texts: How do I create a view that shows how many users have subscribed to each taxonomy term?

texts:
I have built a Drupal site with an event content type that can be tagged with one or more taxonomy terms.

Users can subscribe to these taxonomy terms and receive an automated email notification when content is created that is tagged with that term. This is achieved via the Subscriptions module.

We now require stats on how widespread the subscription service is being used, ideally I would like to create a view to show how many people are subscribed to each taxonomy term (and possibly the names of the individuals). I've tried researching this but to no avail.

Does anyone have any idea how I could do this?


texts: #ajax callback is not working in drupal8

texts:
In Drupal\module_name\Form\AddTemplate form

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\InvokeCommand;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

$form['fieldset']['add_new_event_btn'] =
             array(
                '#title' => t('Add new event trigger'),
                '#value' => t('Add new event trigger'),
                '#type' => 'button',
                '#attributes' => array(
                    'style' => 'margin-top:20px;width:200px',
                    'id' => 'imageBtn',
                    #'OnSubmit' => 'my_function();return false;'
                    ),
                '#ajax' => array(
                    // Function to call when event on form element triggered.
                    'callback' => 'Drupal\module_name\Form\AddTemplate::enable_event_trigger',
                    // Effect when replacing content. Options: 'none' (default), 'slide', 'fade'.
                    'effect' => 'fade',
                    // Javascript event to trigger Ajax. Currently for: 'onchange'.
                    'event' => 'click',
                    'progress' => array(
                        // Graphic shown to indicate ajax. Options: 'throbber' (default), 'bar'.
                        'type' => 'throbber',
                        // Message to show along progress graphic. Default: 'Please wait...'.
                        'message' => NULL,
                    ),
                ),
            );

And in enable_event_trigger function

/*
     * function to enable the new event trigger box
     */
    public function enable_event_trigger(array &$form, FormStateInterface $form_state){
        //Instantiate an AjaxResponse Object to return.
        $ajax_response = new AjaxResponse();
        $ajax_response->addCommand(new InvokeCommand('#edit-email-subject', 'val', 'adipoli'));

        //Return the AjaxResponse Object.
        print_r($ajax_response);exit;
        return $ajax_response;
    }

But it didnt worked ,its not even going to the callback function  any idea ??

UPDATE

I was forget to include js via library ($form['#attached']['library'][]) in the form , thanks :)


texts: Increasing the search query limit (Apache Solr)

texts:
We want to create a search page with Apache Solr with an increased query limit. I was reading that using hook_search_execute was not a recommended way to do this.

Is this statement correct? What would be the recommended way to go about this?

Apache Solr Views module?

Some other solution?

The page absolutely has to have more than 10 search results, and no pager.


texts:
Is it possible to translate the suffix of an integer field? The prefix/suffix settings doesn't appear under the translate section for the field. And I tried searching for the string in "Translate interface" with no luck.

The field is being used in a view where all the fields are in a list, any alternative solutions are also welcome.
Using Drupal 7.


texts:
I try to use that script in my Drupal site https://tutorialzine.com/2013/05/mini-ajax-file-upload-form

I did not use drupal form api. I used my html same with that script.

I created 2 pages with hook_menu.

On first page I use that script to upload files.
That script sends files via ajax to 2. page. But I could not save files as managed file.

On second page I save datas as json to logs to see what i get in that file.
That is an example json;

 {"name":"aa.jpg","type":"image\/jpeg","tmp_name":"\/tmp\/phpWkCoI6","error":0,"size":8575}

How can I save files as managed file on second page?


texts:
TL;TR: Like there is no module like this for D8, how can I create a plugin wich has two fields: one to reference content and onther one to store a number, so I can emulate an inventory.

Hi, I'm using Drupal 8. Is there any module that let me put just a simple number for a node reference? something like an inventory or quantity field.

I've checked for an inventory field on drupal.org but seems to be pretty outdated (drupal 5)

Like an example just image you are going to make an inventory of the animals and plants in a given area; so there is a content type for "animals" and there is a content type for plants (every one with it's own atributes)... and there is a content type "country". So when I'm creating a country I'll like to specify how many dogs, cats, mules, cows, pines, etc does it have. Note that the country has a field that references to the animal or plant node. Using D8, pointing me to an API that let me store and correlate the information can also help me.


texts: Import legacy site URLs via url_alias table

texts:
I have a long table of legacy site URLs (Drupal 6 site) and the new URLs they should redirect to on the new site (Drupal 8). The list is too long to make this an .htaccess fix, and too irregular for an easy rule.

I tried simply inserting the rows into the url_alias table and have found that they don't work unless I find them in the URL Aliases admin page, edit them and save them. I guess this means that the redirects are stored somewhere else as well as that table. Clearing the cache manually didn't seem to help.

I can't think of a way to do what I need with the various path / redirect modules I've found so far (though I'm really open to trying) and most of the code samples out there are D6 or D7. Is there a way (as a one-off) that I can get Drupal to re-read the entire url_alias table and make them proper redirects? Or is there another way to get all the redirects in place? Any help much appreciated!


texts: How to create reusable custom page templates

texts:
I'm working on a custom theme and I have two page templates.

page.tpl.php
page--node--637.php

Template 1 is the default template. Template 2 is identical to template 1, except the layout is slightly modified.

Now, I have some more nodes for which I would like to use template 2 (the slightly modified layout).

The only way I know of to do that is to duplicate the template for each node and modify the node id.

For example:

page.tpl.php
page--node--627.tpl.php
page--node--152.tpl.php
page--node--28.tpl.php
page--node--62.tpl.php
...

Rather than create a bunch of identical templates that must be maintained, I'd rather make template 2 generic (call it something like page--alt.tpl.php) and then specify which pages should use that template (I'm guessing that would go in my theme's preprocess hook).

Is there a way to do that?

[Update]

I will look into Panels and Context to see if I can figure it out. This is an inherited project and the ways in which panels and contexts are being utilized isn't clear, especially for someone like me who hasn't really worked with either module.

That's why I was attempting to solve the issue at the theme level.

Here are a few more details that may help:

The client isn't worried about being able to configure which layout is used. This is a one-time thing for a certain subset of pages. If configuration is necessary, that functionality will be developed in the future.
In particular, we need all pages under a certain path to use this alternate layout. For example, we need to enforce this layout for /about/*.

I'll spend some time learning panels and contexts, but perhaps these details will help inform other solutions?


texts: How do I set up the Crumbs trail For Commerce Kickstart Checkout?

texts:
Using Crumbs 7.x-1.10

During Checkout, the standard flow is 3 pages:

Cart ---> Shipping ---> Review

But at that last (3rd) step the Crumb trail shows

Home > Checkout > Checkout > Checkout

How do I set the Crumb trail to reflect the page H1s?

Is this done via the standard Setup page or 2. Does it require a plug-in? And if a plug-in can someone give me an example for this use case? Frankly, I'm having trouble understanding the nomenclature of both the std. Setup -and- the plug-ins of the docs.


texts: How to fix a field with unlimited values where the "Add another item" is broken?

texts:
I am working on Drupal 7.43.

I have created a few months ago standard fields (text) with unlimited values. Everything was fine.

Today, I can not add another item, the Javascript icon is turning and then nothing happens. Surprisingly, it works on a local version. The weirdest thing is when I use a fresh field, created for test, everything works fine and I can have multiple values added.

In recent log messages, I have an AJAX warning : Invalid form POST data. (EDIT : this warning message is not displayed each time I try to add another item.)

I have tried many different things (jQuery Update configuration, new theme, deactivation/reactivation of modules, cache flushing...).

Does anyone know if I could fix my "broken fields" so I can still use them instead of creating new ones and cloning all the values already entered?
Thanks in advance.

A similar issue here

EDIT (05/09/16) :

Looking at the Firebug Console, in JSON tab, I have just noticed that 2 lines are missing, compared to my localhost version, where the function works fine. The lines missing :

Object {command="add_css"...}
Object {command="insert", method="prepend", selector="head"...}.

Seems important? Any way to get these lines on the production website?


texts: I am confused as whether there is even a need for me to enable content profile, I mean you can use profile of drupal that has the ability to enable extra fields and all.Whileas content profile only has one field, Name, Bio ....


texts: I have created a node with a cck select box which comes with a few possible values. How would I code a module to change the value from one value to another? For example, the default value of field_model is Oldsmobile, and I want to write code which will change it to Toyota?


texts: Use the same login credentials with different core versions

texts:
I have a Drupal 7 site, and I createda  new Drupal 8 site. I would like to use the login credential from the Drupal 7 site in the Drupal 8 site.

How can I achieve this?


texts:
I have a node type 'faq'. For node type 'faq' I need to remove the tab 'node clone'.

For that I have done the following codes.
In node_clone.routing.yml I have the following code

node_clone.prepopulate_node:
  path: '/node/{node}/clone/prepopulate'
  defaults:
    _title: 'Clone content'
    _controller: 'node_clone.form_controller:getContentResult'
  requirements:
    _custom_access: 'node_clone.form_controller:access'
    #_node_add_access: 'node:{node_type}'
    node: '\d+'
  options:
    _node_operation_route: TRUE
    parameters:
      node:
        type: 'entity:node'

In my controller file

public function access(AccountInterface $account, NodeInterface $node) {

      $node_type = ($node->getType());
      if($node_type=="faq")
      {
          $access = new AccessResultForbidden();

      }

    if ($account->hasPermission('clone node') || ($node->uid->value === $account->id() && $account->hasPermission('clone own nodes'))) {
      $access = new AccessResultAllowed();
    }

    else {
      $access = new AccessResultForbidden();
    }
    $access->addCacheableDependency($node);
    $access->cachePerPermissions();
    if ($access->isAllowed()) {
      $access = $access->andIf($node->access('view', $account, TRUE));
    }
    if ($access->isAllowed()) {
      $node_type = NodeType::load($node->getType());
      $access = $access->andIf($this->nodeAddAccessCheck->access($account, $node_type));
    }
    return $access;
  }

Please help me to find out what's wrong with my code? Is this enough or I should do something else?


texts: How to configure xml sitemap for multi language site.For translation I am using i18n module and for xml sitemap. Now there are only one link show in NL site map and 26 in default language.


texts: DB Select Query with Related Links to related pages

texts:
I am displaying data from database with list format, as shown here:

<?php
        $dbresult = db_query("SELECT country_name FROM {countries} order by country_name ASC");
        $theanswer[] = $row->country_name;
        ?>

Countries

<form id="live-search" action="" class="styled" method="post">
                <fieldset>
                <input type="text" class="form-control" id="filter" value="" placeholder="Search By Country" />

                </fieldset>
            </form>

            <?php foreach($dbresult as $row){ ?>

<?php echo $row->country_name; ?>

            <?php } ?>

I want to get the link to every list related link.

In Drupal 7 can we connect basic pages which we are creates dynamically can we hava a chance to related links, or any other way?


texts: Moving, Removing, Disabling Administration on live server

texts: On my staging server people should be able to access the administration to add, delete or edit content. The complete installation including the database is then deployed to a live server. On the live server I don't want anyone to be able to access the administration. In other words if a user goes to mylivesite.com/admin the response would be a 404 - not found. What would be the best approach to achieve this?


texts: in drupal 7, how can drupal link to another remote service, consume the data in the web service such as nodejs?

texts:
I am using the drupal 7 for my CMS server, at the same time, I have a nodejs based server, I need the drupal link to my nodejs server in order to make drupal consume the data in the nodejs based server, which will expose the restful service interface

Is there such a module that could link to the remote web service like nodejs rest, consume the data in the web service and expose the remote data as a view? and how to establish the authentication between drupal and nodejs?


texts: Can Drupal site logout user when he change IP Address?

texts:
Can Drupal site logout user when he change IP Address or ask user to confirm password again?

I need to implement follow requirements:

Log source IP address changes during application sessions.
Notify the user of potentially suspicious activity.
When IP address changed, ask user to confirm password again.


texts: Generate only parent taxonomy terms in a block

texts:
I need to generate a menu for parent taxonomy terms.

How would I go about doing this? I'm also looking to generate these terms in a block.

I have a views set up right now that displays just all taxonomy terms. I can't figure out how to filter out child terms. Is there a filter for this, or do I just have to manually create each category item?


texts: How to get the uid of a newly created user?

texts: I've been searching for this for ages, but could not come with a solution. Drupal 7 provided a way to get the uid of a newly created user after running user_save; the new user has been added and the uid has been returned in the object. However, now in Drupal 8 when I use the User::create() method, it only returns a constant based on whether the user has been created or updated. Is there any way to get the uid after the user has been created though? I don't seem to find a way. Any help is appreciated.


texts: Get download link for file issued by Commerce File via PHP

texts:
I have set up the Commerce Module on my website with the Commerce File contrib module, which is working fine. However, I would like to be able to display the links to the files that have been purchased on a seperate node. So is there any way that I can use PHP, or even tokens, to get the URL that enables the user to download the file for use in my own hyperlink on a custom node?

I think I've made that clear enough, but please don't hesitate to ask if you need me to clarify anything.

Thanks in advance


texts: How do I delete all the relations on my site?

texts:
I want to remove all the relations (created with the Relation module) on my site because I have replaced them with an entityreference field.

At /admin/structure/relation, I can delete the Relation Types, but this does not delete the relations belonging to each type.

At /admin/content/relation, I can delete the relations individually, but there are 100K relations on this site.

At /admin/structure/views/view/relations/edit/page, with the Views Bulk Operations module enabled, I can change the contextual filter Relation: relation type to "Display all results for the specified field" for When the filter value is NOT in the URL and then add a bulk operation to delete item under Fields.  This allows me to go to /relations and trigger a bulk operation to delete all the relations.

Is there a faster way that doesn't involve customizing views?


texts: Dynamic view listing nodes in proximity dependent on taxonomy term in url - which is not attached to the node itself

texts:
I think what I want is quite complex, but maybe someone can help me with some basics of it.

In d7 I have a content type and each node uses address field and via geocoder creates the geo data for that node. I use taxonomy terms here to categorize the node (eg: shop, restaurant, hotel, etc ..) and some nodes may have multiple categories added as they may be multiple types at the same time(one may be a restaurant as well as hotel).

I have created a taxonomy tree as such:

country -> city, eg:

england -> london
        -> manchester
        -> newcastle

Each city also has geo data attached to it. The country and city will be used in the url to filter the results based on a set proximity.

So, for example I could have this url

www.example.com/england/london/restaurant

which is equal to (for examples sake)

www.example.com/country/$2/$3

The country page is a static page that may list taxonomy terms (cities) for that country.

The next page up - selecting the city from the country page - does not yet display a view, but gives options for which category the node is in (this taxonomy term is attached to the node (Shop, Restaurant, etc ..))

Now I want to create a view that uses term $2 to set the location from which to start the proximity search from (the geo data is already added to the taxonomy field for cities and mustn't first get geocoded from the city name)

Then term $3 is the category which is attached to the node.

It then displays all the nodes from that category at a  previously set distance (radius) away from the cities geo data. I presume I can either create an admin field where the distance can be set or simply hard code it in the module.

So, I am quite new to creating my own custom module and apart from field api I have not had much experience with other drupal api's - especially the views api.

Here is what I need to do - as far as I am aware:

Create a custom module - I don't think I can get around that - that:

1) gets the $2 and the attached geodata

2) creates a view for all nodes with taxonomy term $3 attached to it and filters them using proximity to only show nodes in a XX km radius from the geo point supplied by $2.
  This obviously includes converting lat/long to distances from the set point...

3) I want to be able to display a proximity slider so the radius value can be changed and the view refreshes.

I know this sounds like a massive job, but I thought that maybe I could do some of it directly in views and then maybe use some alter_hooks to add queries (for example to grab the geo data for $2)...

Can anyone help me with this, or give me some tips on how this can be done?

I just need some sort of strating point as I am totally new to this. I would also supply any code written back to the community and document my processes for others to follow.

Many thanks in advance.


texts: How to solve "Query failed" error in drush sql-sync output?

texts:
This is a follow-on to my earlier question on this site.  I hope posting it as a new question is appropriate.  I'm trying to clone an existing drupal installation into a place on my mac with the commands:

echo "Pushing private files"
/usr/local/bin/drush core-rsync @hpc.dev:%private @hpc.local:%private
echo "Pushing webroot files"
/usr/local/bin/drush -y core-rsync @hpc.dev @hpc.local
echo "Pushing database"
/usr/local/bin/drush -y sql-sync --no-cache @hpc.dev @hpc.local
echo "Clearing Drupal cache"
/usr/local/bin/drush -y @hpc.local cc all

The sql-sync bit is failing with the following error:

Copying dump file from Source to Destination.                                      [ok]
Starting to import dump file onto Destination database.                            [ok]
/usr/bin/php /usr/local/drush-master/drush.php --php=/usr/bin/php  --backend=2        [notice]
--verbose --yes --strict=0 --root=/Users/cook47/Sites/drupal-test/html
--uri='http://localhost/~cook47/drupal-test'  sql-query
--file=/tmp/hpc-drupal-dev_20160302_175129.sql.gz --file-delete 2>&1
Executing: gzip -d /tmp/hpc-drupal-dev_20160302_175129.sql.gz
Executing: mysql --defaults-extra-file=/private/tmp/drush_wKQDuq --database=hpc-drupal-dev --host=localhost --silent  < /tmp/hpc-drupal-dev_20160302_175129.sql
Query failed.                                                                      [error]
Command dispatch complete                                                             [notice]
Command dispatch complete                                                             [notice]

The sql file does exist.  I think the problems is that --defaults-extra-file part, because when I run that last command by hand, I get this:

cook47@rcmac (Downloads ):  mysql --defaults-extra-file=/private/tmp/drush_wKQDuq --database=hpc-drupal-dev --host=localhost --silent  < /tmp/hpc-drupal-dev_20160302_175129.sql
mysql: [ERROR] Could not open required defaults file: /private/tmp/drush_wKQDuq
mysql: [ERROR] Fatal error in defaults handling. Program aborted!

I have no idea where that --defaults-extra-file=/private/tmp/drush_wKQDuq comes from.  It's nowhere earlier in the output.  The directory /private/tmp/ exists and I can write to it.  Here is the 'local' array alias in my hpc.aliases.drushrc.php file:

$aliases['local'] = array (
  'root' => '/Users/cook47/Sites/drupal-test/html', //CHANGEME
  'uri' => 'http://localhost/~cook47/drupal-test', //CHANGEME
  //'remote-host' => "localhost",
  //'remote-user' => 'cook47',
  'path-aliases' => array (
    '%drush' => '/usr/local/bin/drush', //CHANGEME
    '%site' => 'sites/default/',
    '%files' => 'sites/default/files',
    '%private' => '../private',
    '%dump' => '/Users/cook47/Sites/drupal-test/drush-dump.sql',//CHANGEME
  ),
  'target-command-specific' => array(
    'sql-sync' => array(//CHANGEME
      'enable' => array(),
      'disable' => array(
      ),
    ),
  ),
  'command-specific' => array(
    'rsync' => array(
      'mode' => 'vrlzOk',
      'exclude-conf' => 1,
    ),
  ),
);

Anyone able to resolve this or point me to how to resolve it?


texts: modal window "loading" not loading in SCALD

texts:
I'm working on a site using SCALD – and for some reason the modal media upload window does not work anymore. It's stuck with the status "loading…" but not going anywhere.

I first had it running like a charm – then I 'just' wanted to add multi-language support to the website adding i18n… Then when I checked again on SCALD this is all I get:

Firebug console is showing the following two messages:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help xhr.spec.whatwg.org ...A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertB…" (jquery.js?v=1.4.4 line 139)

and

uncaught exception: The editor instance "edit-body-und-0-value" is already attached to the provided element.

Firebug network: "POST ajax 200 OK"

So for what I can see from other modules ajax is up and running. Checking on other forum questions here on drupal-stackexange concerning modal window problems didn't help yet – so I just hope somebody has some pointers that would direct me in some direction… ThankYou!

–EDIT-
manual upload (atom/add/image) works and also using the SCALD library incl. drag'n'drop works fine. Just opening the modal dialogue either through "add" or "edit" form the SCALD sidebar does not load.

PS: not using the jQuery update module


texts: How do you handle multiple feed URLs in a migration?

texts:
I have a drupal migration that also uses migrate plus from a feed URL that can be queried. For example the migration can work for a single response from the feed at

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: xml
  urls: http://myfeed.com/newsfeed/get.php?id=123456

I would like to migrate content at 123456 and then 123457, then 123458.  How could this be done?


texts: Is there a module for Drupal 7 similar to OG Membership Expiration?

texts: OG Membership Expiration is for Drupal 6. Is there a similar module for Drupal 7?


texts: Display users webform submission as readonly?

texts:
Is there any built-in way to display the questions on a webform and the user's responses as read-only?

The site I'm building allows a user to answer survey questions up to a given cut-off time. Once they've submitted the answers and the time-limit ends they must be able to see what they said, but not change it.

I can't see any obvious way of doing that, is there an easy answer? :-)

I know I can modify each field individually in a form_alter hook but that's not ideal...


texts:
We have recently observed that we can put Drupal in an inconsistent state where it responds with a server reset or WSOD, where no data is sent. This by simply having some faulty configuration (See CCK field migration reproducibly results in server error )

We have started to doubt the robustness of the our Drupal instance (and even Drupal in general if it is so easy to push off the tracks), so we want to look into this event further and understand exactly why, because in any case even a cryptic error message would be preferred over just dying.

How to debug such a situation, properly? There is no output whatsoever, neither in the logs nor to the browser. We have enabled the devel module debug outptu an krumo output, but it dies before this. We have also tried to catch sql queries using pg_top, nothing.

What do?


texts: Drupal multi language and google translate

texts:
I have following situation:

I created a multi language site in Drupal for English and German. This works perfect, with German as the main language.
for other languages like Polish and Russian, I want to use google translate.

I installed the Google Translate module and activated the needed languages. I have active the block, so I will see the languages and can translate the website.

Now I have following problem:

I have now two flags with German on the website. one from the normal translation and one from the google translate module. I want to remove the German flag from the google translate module. I could hide the flag with css, but then the website will not work as expected.

Following situation:

I select the English flag, then the English version of the website will be shown.
I select the Polish flag, then google translate will translate the website to polish.
I select the German flag from Drupal, then the german url will be used, but google translate will translate the website to polish. I have click on the german flag of google translate, then the german version will be shown.

How I can solve this problem?


texts: How do I manage a mix of menu and custom breadcrumbs?

texts:
I have a site where I need breadcrumbs to be generated in a couple of different ways:

Based on the menu path (Menu Breadcrumb)
Based on custom rules (was thinking Custom Breadcrumb but it doesnt exist anymore)

How can I effectively enable breadcrumb rules for nodes that I don't want Menu Breadcrumb to control? Do I have to create my own Breadcrumb builder class? Can I blow away $breadcrumb in hook_system_breadcrumb_alter and do new Breadcrumb() to do exactly what I want?


texts: Running triggered rules actions in the background?

texts:
I am using triggered rules to set off potentially lengthy actions on nodes, e.g. automatic node translation using Google Translate. Running those actions during the node creation page request slows down the response and potentially uses up server resources.

Instead, I'd like to enqueue the actions, so that they may be executed during the next cron run, or via the Queue API. Is there a known way to achieve this? Is it possible to do that using Rules Scheduler?


texts: Adding HTML5 placeholder to all drupal forms

texts:
I'm trying to add the placeholder attribute to all textfields across my website, but I'm having no luck.

I've created a module that overrides hook_form_alter

function mymodule_form_alter(&$form, &$form_state, $form_id)
{
    foreach ($form as $key => $value) {
        if ("textfield" == $value["#type"]){
            $value['#attributes']["placeholder"] = t($value["#title"]);
        }
    }
}

I should tell you that I'm also using the webform module.


texts:
I have two path one is "book/content/9(book_id)" render a View page
and another is "book/content/book_alias" (autopath)

Now view get a argument 9 and display a View Page but when "book/content/book_alias" is requested display a node rather than node in View Page
why this happen ? and how to solve this ?


texts: How do I get the path to a directory of an image file and how do I get the name of the image?

texts:
I am new to Drupal and new to twig. I am currently using Drupal 8.1.1. I would like to obtain two things, the directory path of the image and the image name. I can get the path to the image using twig:

{{ file_url(content.field_image['#items'].entity.uri.value) }}

Is there a way to do this? For example, I get /path/to/image.jpeg using file_url(), is there any function to return /path/to, the path to the image directory and the image name?


texts: How to add number of records per page filter in views

texts:
I want to add a filter to customize the number of records to be show on per page in views.

Can anyone assist me on this?


texts: Is there a way to get Views Bulk Operation to place field options in the main VBO exposed dropdown

texts:
I am using VBO to set the author for a one of my content types.  Currently, when you want to use the change author page, you have to..

Navigate to the page.
Select the target content items
Select 'Change Author' from the VBO drop down list (this is the only option)
Wait for the new page to load
Select the new author form the (only) drop down lost on this page.
Submit

It seems that there are a lot of extra steps here.  Is there a way to set-up the primary VBO drop down list (refereed to in step 3) so that it displays the different authors (like the drop down refereed to in step 5?)


texts: How to theme a paragraph bundle with a template file?

texts:
I am using the Paragraphs module version 7.x-1.0-beta6 I have a bundle with the machine name: text_buttons

In the paragraphs module there are two theme suggestions:

 paragraphs-items.tpl.php
 paragraphs-item.tpl.php

if I copy paragraphs-items.tpl.php to my template folder under my theme, i can modify the code and see the changes reflect site wide wherever there is a paragraph bundle.

Now when I go to target a specific paragraph bundle nothing happens at all.
I've followed the solutions in the following threads:

https://www.drupal.org/node/2326443
https://www.drupal.org/node/2481339
https://www.drupal.org/node/2399631

Nothing seems to work. Is the module currently broken? do I have to implement some sort of theme hook? I've made sure to flush caches on every change just to ensure I would be seeing the template file but it doesn't work, I've never had a problem with finding theme names before.. The documentation is non-existent for this module, and i really don't want to dig into the module code right now.

Another thing to note is that paragraphs-item.tpl.php does nothing on my website from either the module or my theme directory. it seems only paragraphs-items.tpl.php works out of the box.

I've tried:

paragraphs-items--text-buttons.tpl.php
paragraphs-items--text_buttons.tpl.php
paragraphs-items-text-buttons.tpl.php
paragraphs-items-text_buttons.tpl.php

field--paragraphs-items--text-buttons.tpl.php
field-paragraphs-items--text-buttons.tpl.php
field--paragraphs-items--text_buttons.tpl.php
field-paragraphs-items--text_buttons.tpl.php

field--paragraphs-items-text-buttons.tpl.php
field-paragraphs-items-text-buttons.tpl.php
field--paragraphs-items-text_buttons.tpl.php
field-paragraphs-items-text_buttons.tpl.php

Anyone have an idea why I can't theme my paragraph bundles?