texts: Content translation not working on the front page

texts:
I have a translation problem on my site in drupal 9.1.3.
I have a content type for my homepage that contains two fields: field_slides which is an EntiyReferenceRevisionFieldItemList to a Paragraphs field and field_tabulations which is an EntityReferenceFieldItemList to a "tab" content type.
This type of content contains 4 fields including a Paragraphs field.
My configuration in admin / config / regional / content-language is correct. And I only enabled translation for child paragraphs fields as said in the documentation.
In the template I call the title field of the entity referenced by field_tabulations as follows:
{{ elements['field_tabulations']['# items'].0.entity.title.0.value }}

However, the home page node fields in my template front page are not translated. The blocks are, however as the main menu is.


texts: Uploaded images in theme settings is going to be lost

texts:
I have a flexslider and I make its images customizable through the theme settings. I added a caption property for the the slide to meet multiple languages websites as follows in theme-settings.php:

// setting property to determine the rendered images fields
$form['best_responsive_settings']['imagesCount'] = array(
      '#markup' => t('Enter the total number of images in the slideshow'),
      '#type' => 'select',
      '#options' => associate_array_vals(explode(',',  theme_get_setting('imagesCountOptions'))),
      '#selected' => theme_get_setting('imagesCount'),
      '#default_value' => theme_get_setting('imagesCount'),

  );

  $lang_list = language_list();
// rendering upload image form with caption textfield for every language supported by the website

  for ($i = 0; $i < theme_get_setting('imagesCount'); $i++){
      $form['best_responsive_settings']['slideshowImages'.$i] = array(
        '#type' => 'managed_file',
        '#title' => t('Image').' #'.($i+1),
         '#required' => false,
        '#upload_location' => file_default_scheme() . '://slides',
    '#default_value' => theme_get_setting('slideshowImages'.$i,'best_responsive'),
    '#upload_validators' => array(
      'file_validate_extensions' => array('gif png jpg jpeg'),
      'file_validate_image_resolution' => array('960x400','430x400')        ),

      );
      foreach ($lang_list as $lang){
      $form['best_responsive_settings']['slideshowCaption'.$lang->language.$i] = array(
    '#type' => 'textfield',
    '#title' => t('Caption').' #'.($i+1).' -- '.$lang->name,
    '#required' => false,
    '#default_value' => theme_get_setting('slideshowCaption'.$lang->language.$i, 'best_responsive'),
  );
      }
  }

In page.tpl.php I use the following to render the images:

<?php if (theme_get_setting('slideshow_display','best_responsive')): ?>

            <?php for ($i = 0; $i < theme_get_setting('imagesCount'); $i++): ?>
              <?php  if (theme_get_setting('slideshowImages'.$i) != ''): ?>
 //the following line causes a problem after some time

<img src="<?php echo file_create_url(file_load(theme_get_setting('slideshowImages'.$i))->uri);?>" alt="Slide"/><?php if (theme_get_setting('slideshowCaption'.$language->language.$i)): ?><?php echo theme_get_setting('slideshowCaption'.$language->language.$i) ;?><?php endif;?>

              <?php endif; ?>
            <?php endfor; ?>

    <?php endif; ?>
    <?php endif; ?>

Everything, initially, works fine, the images are uploaded to the theme settings and images are rendered well in the slideshow. However, after some time! I noticed that the images are disappeared from the template settings page and only the caption if supplied is remained. In addition I got the following notice:

Notice: Trying to get property of non-object in include() (line 159 of C:\xampp-2\htdocs\4test\drupal-7.28\sites\all\themes\best_responsive\templates\page.tpl.php).

Where the line 159 is the line regarded in the comment of the second code snippet above. This notice is repeated twice. What is the problem here? What is making this code initially works then after sometime it fails? What is making the uploaded files disappeared from the settings. In addition, the destination in-which images should be uploaded /sites/default/files/slides becomes empty. i.e the uploaded images files are deleted!


texts: Administration menu - How to remove the number of users + search bar

texts:
Out of the blue, our administration menu now shows a number like 192/7 on the right side and a search bar.

Does anyone know what causes these items to appear on the administration menu? And how can I remove them?


texts: Can I use a contextual filter to remove content?

texts:
So I have this view that searches for content (articles, blogs, etc.) associated with a particular author name. Is there a way with this that I can pass a contextual filter of taxonomy terms that would filter out content?
So let's say we have a couple articles tagged with "love", and "questions" but I have one article also tagged with "talk". Is there a way I can pass that term "talk" as a contextual filter (or filter criteria) to block it from showing up in the list? Essentially I'm hoping there is something like "Content: Does not have taxonomy term ID" or something like that.


texts: Webform: how to wrap each form field with a div?

texts:
Due to a design request, I need to add a DIV around each textfield/select field in my webform.

Since a webform is, both, a form and a node, I'm struggling to figure out how to do that.

In a normal form, I would use the hook_form_alter() and use the #prefix and #suffix attributes to add extra markup, but when printing out the webform in the hook to see the structure of the fields I can't see how to target each field.

Any help will be greatly appreciated!

Thanks.


texts: Load all titles and body text from one content type into array

texts:
I'm working on an input format filter that should work as following. I have a content-type called glossary, the user can fill in a word (title) and description (body). Then there is a content-type article. When a word in the article matches a word in the glossary it should wrap that word with a span. Something like word. I already did a quick and dirty tryout and that worked fine. I already did a speed test and it worked out fine only a delay of 0.2s max.
But now I try to make it as it should and I got stuck.

The way I think this could work is to have an array with all words and descriptions from the glossary content-type in a array. And then search through the text.

So I created a Plugin/Filter/Filtername.php file. In this file I try to load all node from the glossary content-type (as advised) via dependency injection.

What I found is a way to get all nids, via this code added in to my filter class:

class FilterName extends FilterBase {
    public function __construct(QueryFactory $entity_query)
    {
        $this->entity_query = $entity_query;
    }

    public static function create(ContainerInterface $container){
        return new static(
          $container->get('entity.query')
        );
    }

    public function process(){
        $query = $this->entity_query
        $query->condition('bundle','woordenlijst');
        $nids = $query->execute();
    }
}

So this should give me all nids of the node I'm looking for but how do I get these node loaded to get there title and body text? I found this lesson about entity loading. Which is usefull but there are some deprecated functions used and I have no idea how to combine these to to get een array of titles and body texts.

So what is currently the best method to load nodes and how can I combine this with the code I already have? And am I even on the right path or not, or is there a better/easier way to do this?

Thanks in advance.


texts: How to hide drupal error message - one or more problems were detected with your drupal installation

texts:
On logging on to Drupal administration page, I get an error message:

  One or more problems were detected with your drupal installation.

I've tried disabling modules.

Is there a way to hide this message?


texts:
I have this query in SQL

select *
from node n, node_collection_data nc
where n.nid = nc.nc_child_nid
and
nc.nc_parent_nid = (select nc_parent_nid
from node_collection_data
where nc_child_nid=17)

This is what I got so far:

 $query -> join('node_collection_data', 'nc', 'n.nid =
 nc.nc_child_nid'); $query->condition('type', $node->type)
       ->condition('status', 1)
       ->condition('n.nid', $node->nid, '!=')
       ->condition(db_or()
       ->condition('n.language', array($language->language, LANGUAGE_NONE), 'IN')
         ->condition('n.language', $node->language, '=')
       )
       // get nc_child_id
       //->join('node_collection_' . $sort, $sort, 'n.nid = ' . $sort . '.nc_child_id')
       ->fields('n', array('nid', 'title'))
       ->fields('nc',array('nc_parent_nid')) // select nc_parent_id

I am trying to convert the last part.

nc.nc_parent_nid = (select nc_parent_nid from node_collection_data where nc_child_nid = 17)

How can I convert it to db_select()?


texts:
How to allow media module to support .oft file extension?

Checked supported file extensions in includes/file.mimetypes.inc. It does not have oft extension listed. How can I add it without hacking core files?


texts: Drupal Commerce stop titles of variations replacing product title

texts:
I am new to Drupal Commerce and am using Commerce Kickstart 2.

When I make variations the currently selected variation is replacing the title of the product. I would like the product to have one title that remains fixed regardless of what variation is selected. I'm pretty sure I had managed to set this up in a product/variation combination I had set up before, but now can't find where to set this up.


texts: How to get the values of an array in the options list (hook_rules_condition_info ()) instead of array index?

texts:
'example_condition_user' => array(
      'label' => t('User Condition'),
      'arguments' => array(
      ),
      'parameter' => array(
        'username' => array(
          'type'  => 'text',
          'options list' => 'list_all_users',
          'label' => t('Username'),
          'description' => t('user that the conditions apply'),
         ),
        'user_entry' => array(
          'type'  => 'user',
          'label' => t('user'),
        )
      ),
      'group' => t('exemplo'),
      'module' => 'exemplo',
)

function list_all_users(){

  $query = db_select('users', 'u');
  $query->fields('u', array('name'));

  $result = $query->execute()->fetchAll();
  $ret = array();

  foreach($result as $r){
    array_push($ret, $r->name);
  }

  return array_values($ret);

}

The list_all_users function returns the users (that are in my database) in a array, but the options list does not get the values of the array, but the array index, and this is a problem, because I need the values of the index, and then do the validations rule_condition_info (), does anyone have any idea how to fix this?


texts:
In my content type I have a field (field_fbunique) whose default value is 0; programatically, I change its value to 1 with below code and clear cache. The value is changed to 1, but when users edit the node, the field value is displayed as 0, even thought the value in the database is 1 (as expected). However, to display it as 1, I need to clear cache manually. I have Memcached enabled.

What can I do to solve this?

    $node = node_load($nid);
    $node->field_fbunique['und'][0]['value'] = 1;
    field_attach_presave('node', $node);
    field_attach_update('node', $node);
    entity_get_controller('node')->resetCache(array($nid));
    drupal_flush_all_caches();

In settings.php, I have the following lines related to memcache.

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
$conf['memcache_stampede_protection'] = TRUE;
$conf['cache_default_class'] = 'MemCacheDrupal';

// The 'cache_form' bin must be assigned to non-volatile storage.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

// Don't bootstrap the database when serving pages from the cache.
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

$conf['memcache_servers'] = array('memcached:11211' => 'default');


texts:
I have a list of items which is fetched from an REST API and displayed in a page 10 at a time. These items are not stored in Drupal database in any way. I managed to have a basic pager which is just a Previous & Next. But as per design the list should have a full pager.

So, how can I add a Full Pager in such page?


texts: What is the first function read by Drupal in a custom module?

texts:
I've got a custom module working fine in Drupal 7.

In some pages, I have parameters in the URL that I'd like to get in order to perform certain actions.

For example, if a=logout or a=forgot_password or a=subscribe.

I'd like to know which function, in the mymodule.module file, is called first so I can check whether there's a special parameter and perform certain actions accordingly ?

Thanks in advance!


texts: Set allowed value of a list field depending on the URL

texts:
In the list field php code I want to set the value of a field:

first do a call to parse the URL.
take the [3] element (nid of the organic group) and use it to do a call to the db to get the node type for that nid.
set the value of the field depending on the node type.

I had all this working in D6, now have to redo for D7.  Not having any luck getting it working yet.

function custom_pathnoder() {
    $pathnoder = array();
    $pathnoder = check_plain(drupal_get_path_alias($_GET['q']));
    $pathnoder = explode('/', $pathnoder);
  return $pathnoder;
}

$node = menu_get_object();
$pathnoder = custom_pathnoder();

$group_id = $pathnoder[3];

$query = db_select('node');
 $query->condition('nid', '$group_id', '=')
              ->fields('type');
$og_type = $query->execute();

if ($og_type) {
if ($og_type == 'square_group')  {
$def_value = array( 0 => array('value' => square) );
}

elseif ($og_type == 'west_group')  {
$def_value = array( 0 => array('value' => west) );
}
elseif ($og_type == 'east_group')  {
$def_value = array( 0 => array('value' => east) );
}
elseif ($og_type == 'circle_group')  {
$def_value = array( 0 => array('value' => circle) );
}
elseif ($og_type == 'north_group')  {
$def_value = array( 0 => array('value' => north) );
}
elseif ($og_type == 'south_group')  {
$def_value = array( 0 => array('value' => south) );
}
}

if (isset($def_value)) {
  return $def_value;
}
else {
  return array(0 => array('value' => null));
}
}

@Shawn Conn

I changed the code to reflect the suggestions above but it's still not setting the value.  Can you see the reason?

def_value = array();
$pathnoder = array();

$pathnoder = check_plain(drupal_get_path_alias($_GET['q']));
$pathnoder = explode('/', $pathnoder);

$og_type = db_select('node','n')
    ->fields('n', array('type'))
    ->condition('nid', arg(3), '=')
    ->execute()->fetchField();

switch ($og_type) {
    case square_group:
         $def_value = array( 0 => array('value' => square) );
         break;
    case west_group:
         $def_value = array( 0 => array('value' => west) );
         break;
    case east_group:
       $def_value = array( 0 => array('value' => east) );
       break;
    case circle_group:
       $def_value = array( 0 => array('value' => circle) );
       break;
    case north_group:
       $def_value = array( 0 => array('value' => north) );
       break;
    case south_group:
       $def_value = array( 0 => array('value' => south) );
       break;
}
if (isset($def_value)) {
  return $def_value;
}
else {
  return array(0 => array('value' => null));
}


texts: How to create a module in HTML directly?

texts:
For instance, I would like to create a module like

    First Name: <input type="text" ng-model="firstName">

    Last Name: <input type="text" ng-model="lastName">

    Full Name: {{firstName + " " + lastName}}

But what I found is that I have to create the module in PHP (For example, mymodule.module), import JavaScript file using drupal_add_js, create functions to establish a form in phpm etc.

So is there any way or an example to create a module directly with HTML?


texts:
I want to add a new price field called Discount to a product. So now I have two price fields, Price and Discount.

Then with the help of the rule, I am interested in showing in the node page the price(with line-trough) and the discount.

Then when adding the product to the cart, the discount price will be added, instead of the normal price. How can I achieve this with rules?

PS: I don't want to use the Commerce Sale price module since it doesn't integrate with Search api.

I have found these instructions but I am not sure how to create the rule!

Add another price field to your product type.
Add a rule that applies the discount to the price on that product if the extra price field exists. Make sure you use the Discount price component when creating the rule.
Use Extra Price Formatters to display the difference.


texts: How to rename or choose twigs file name suggestions?

texts:
When I create a custom block called Lorem ipsum Dolor, I have not the possibility to choose the machine name. So when I have to make a twig template, the file suggestion is :

  block—loremipsumdolor.html.twig

I mean it is without undescore. I found it hard to handle all these twig file when I work on a custom template. It is not human friendly readable.

Is there a way to choose the name of the file name or the block machine name ?

Other example :

  Block name : Custom Search form

<!-- FILE NAME SUGGESTIONS:
   * block--customsearchform.html.twig
-->

I have not this problem with node :

  node--13--teaser.html.twig


texts: hook_form_alter hiding field only in the form

texts:
I have a content type with fields added from the core module and I want to hide some fields in the edit form, but not in the page node.

I've tried with

$form['my_field']['#access'] = FALSE; in my custom module, but that hides the field in the node page too.
Is there any other way to hide the field only in edit form?

My approach was to wrap some fields into a two columns. Here's what I've tried:

  <?php
    /*
     * Implements hook_form_alter().
     */

    function my_module_form_alter (&$form, &$form_state, $form_id) {
         switch ($form_id) {

          case 'custom_node_form':

          $form['column_left'] = array(
          '#prefix' => '
',
          '#suffix' => '
',
            );

           $form['column_left']['custom_field'] = $form['custom_field'];
           $form['custom_field']['#access'] = FALSE;
         break;
       }
    }

Unfortunately it's disabling into the page node too. I'm using Display suite for the full content and I'm pretty much sure that the field is not hidden from there.


texts: Aegir / drush alias issue: profiles specified at command line get forgotten

texts:
Note: Aegir is an installation / site management tool for drupal sites & platforms. See http://community.aegirproject.org/ for details.

This question may be down to an Aegir issue or a drush one; thoughts from either angle are welcome:

I've managed to create Aegir/drupal platforms via both the command line (see http://lists.aegirproject.org/pipermail/aegir/2011-January/000026.html) and web interface, and I can get sites to install with a selected profile through the web interface, but when I try to install a site via the command line it keeps resetting to the default profile. Can anyone see what I'm doing wrong here?

I create a site alias:

drush --uri='demo.c.didev.co.uk' provision-save '@site_demo.c.didev.co.uk' --context_type=site --platform='@platform_dennis_generic_20110316b' --profile='myprofile' --db_server='@server_localhost' --client_email='me@domain.com'

and it creates a valid alias file:

cat .drush/site_demo.c.didev.co.uk.alias.drushrc.php
<?php $aliases['site_demo.c.didev.co.uk'] = array (
'context_type' => 'site',
'platform' => '@platform_dennis_generic_20110316b',
'server' => '@server_master', 'db_server' => '@server_localhost',
'uri' => 'demo.c.didev.co.uk',
'root' => '/var/aegir/platforms/dennis_generic_20110316b/',
'site_path' => '/var/aegir/platforms/dennis_generic_20110316b//sites/demo.c.didev.co.uk',
'site_enabled' => true,
'language' => 'en',
'client_email' => 'me@domain.com',
'aliases' =>  array ( ),
'redirection' => false,
'profile' => 'myprofile', );

However, when I run "drush @hostmaster hosting-import @site_demo.c.didev.co.uk" it rewrites the alias file to "profile = default" and installs with the default profile!

Now, this is a pain but not a disaster as I can do the initial site creating via the web interface and it'll work, but I get apparently related errors when trying to migrate on the command line (per instructions at http://community.aegirproject.org/node/41) where it appears to not create an array of profiles and crashes (I'll post on that separately later) and wanted to rule out these problems before I tackle those.

So - am I doing something wrong, or is there just a bug?


texts: How to update user profile after submitting a webform?

texts:
We have a webform and our clients can register for an event using this webform, some of fields are preloaded in the form like "firstname" or "lastname", but i like to update the user info in the user's table in case if the user change his/her info in the event registration webform.

I like to know also how can I update user info using single query because when I look at Drupal database, every single info is in different table like 'field_data_field_first_name' !

I'm not really experienced in Drupal development, so thx for ur help.


texts: Why aren't all changes made to Saas files working with Zen 5.x?

texts:
I'm starting with theming and chose Zen 5.x for multiple reasons. Problem is, all this being new, I feel a little overwhelmed. I know how to "watch" the sub-theme directory with compass from the command line but all changes I make don't seem to make it through.

I've been trying to use Codekit to see if my assumption was about right and what I see are greyed out Sass files (all but styles.scss, as a matter of a fact). However, changes to _layout-responsive.scss do overwrite CSS files but _layout-fixed.scss don't.

Could someone please tell me more about all this?

Thanks


texts: Unable to retrieve user id of edited user from $entity in hook_field_validate

texts:
I have this little problem with a custom field that is bundled with user. In its validation function I need to have access to the user id of the user whose field is being edited.

What that means is, when I edit a user, I need to get his uid in the validation function.

The problem is that hook_field_validate provides just $entity variable that doesn't include uid.

I know I could load the user object using his email / name (and then retrieve the uid from it) but it wouldn't properly work when email/name was being changed (I could get only the changed values from $entity and therefore wouldn't be able to load the object properly).

Any ideas?


texts: Set a custom module variable based on webform nid

texts:
I am working on a custom module that hooks into Webform in various ways. Right now I am saving variables using system_settings_form and understand that these will go into a Drupal variables table somewhere.

What I am trying to do is pass the NID of the Webform that my form appears on into the variable name, so I can pull them out based on that particular form in the future.

For instance:

function MYMODULENAME_form($form, &$form_state) {
  $form['MYMODULENAME_group_node_' . $nid] = array(
    '#type' => 'textfield',
    '#title' => t('Group ID'),
    '#default_value' => variable_get('MYMODULENAME_group_node_' . $nid),
    '#size' => 6,
    '#maxlength' => 6,
    '#description' => t('6 Digit Segment ID Identifier'),
    '#required' => TRUE,
   );
 return system_settings_form($form);
}

Where $nid is the Node ID from the form.

I am not sure if this is best practice at all. If anyone could point me in the right direction that would be most appreciated.


texts: How can I reference more than one media entity in a custom migration

texts:
I have a custom migration script that uses 4+ sheets to migrate data into two different content types (that reference each other), along with referenced users, and most important to my question, references media entities that I import/migrate as part of the tagged migration group.
I am able to successfully 1) import the image/file entities, then 2) create "proper" media entities from the file import and 3) reference a SINGLE media entity in one of the nodes (the business_branch node for each business location. The trouble is, I'm not able to use the migration_lookup plugin to attach more than one media entity to the respective node.
Ultimately, I want to create a business_branch node that has various business information (like hours of operation, address, etc), AND link up to 10 different media (images) to that node. I've got everything else migrating beautifully...but I can't get MULTIPLE media entity references to work. I have tried various other drupal migration plugins like explode and sub_process etc (or combinations thereof), but for whatever reason, the migration fails (probably because my process chain is not in the right order...or I'm straight up just trying to use the wrong plugins).
Anyway, I created an entire github repo just so it would be easier to answer this question: https://github.com/Doomd/GSheetsToDrupalMigration
To jump right into the particular details I need help with, here's the source Google Spreadsheet I'm using as the source: https://docs.google.com/spreadsheets/d/1GuKab6Ezi3GckSjMD5BmAQVa0qnOKJX9kadWz_mDxcU
On the first sheet of the Google Spreadsheet, I've highlighted the column I would LIKE to use to reference files/images on the second sheet (basically a string of file-id's that are semi-colon delimited). The second sheet contains the source data for the files themselves that are the source migration for 1) gstd_file_image.yml and then 2) gstd_file_image_to_media.yml (which are both migrations that happen before my primary node creation/migration on gstd_node_business_location.yml.
Here is the relevant excerpt from gstd_node_business_location.yml that successfully creates references to a SINGLE media entity. Note, I'm just including the parts for the Photo ID reference column source and destination field:
fields:
  - name: src_photo_id
    label: "Photo ID"
    selector: photoid
~~~ TRUNCATED ~~~
process:
  # Single Photo Works...
  field_media_test/target_id:
    plugin: migration_lookup
    migration: gstd_file_image_to_media
    source: src_photo_id

So the SINGLE reference works. On the other hand, here is ONE (of the many) non-working approaches I've tried to use reference multiple Photo IDs (note, I've created a separate column in the source sheet for multiple IDs for testing purposes):
fields:
  - name: src_multi_photo_id
    label: "Multi Photo ID"
    selector: multiphotoid
~~~ TRUNCATED ~~~
process:
  #attempt to link multiple media items per node (Doesn't work)
  field_media_test:
    - plugin: explode
      source: src_multi_photo_id
      delimiter: ";"
    - plugin: callback
      callable: trim
    - plugin: single_value
    - plugin: sub_process
      process:
        target_id:
          - plugin: migration_lookup
            migration: gstd_file_image_to_media
            source: src_multi_photo_id

Can you please help me correct this Drupal migration so that MULTIPLE media entity references work (similar to how I can reference multiple taxonomy terms to a taxonomy reference field)? Thank you!


texts: Varnish and expire module adding starts with on regular expressions

texts:
I have varnish running with the expire module that sends bans into varnish when an article is published. The problem is that it doesn't expire all versions of an article. Some articles could be expired using something like "article-title$" but whats happening is my bans look more like "^/article-title$" which is not matching all the different urls that could possibly be related to the same article.

Can anyone help me understand how can I use the expire module but remove the starts with part of the regular expression from the ban.

here is an example of the bans i am seeing in ban.list

obj.http.x-host ~ www.mysite.com && obj.http.x-url ~ ^/$|^/node/195888/edit$|^/front$|^/node/195888$|^/another-test-article$|^/taxonomy/term/18841$|^/articles$

the problem being "^/another-test-article$" I would like it to be "another-test-article$" instead so that it will match any links that end with that particular pattern.

Thank you


texts: Drupal autocomplete form, multiple values

texts:
I have created custom module to add user awards. This award = some text(like Php developer of the month) and image, and i need to implement feature, which can add this award to multiple users in this form
This is my form:

function user_awards_admin_settings() {
    $form = array();
    $form['award_description'] = array(
        '#type' => 'textfield',
        '#title' => 'award description',
    );

    $form['name'] = array(
        '#type' => 'textfield',
        '#title' => t('Assign to'),
        '#autocomplete_path' => 'user_awards/autocomplete',
    );
    $form['user_awards_block_image'] = array(
        '#type' => 'managed_file',
        '#name' => 'user_awards_block_image',
        '#title' => t('Block image'),
        '#size' => 40,
        '#description' => t("Image should be less than 400 pixels wide"),
        '#upload_location' => 'public://'
    );

    $form['#submit'][] = 'user_awards_settings_submit';
    return system_settings_form($form);
}

And this is my autocomplete function:

function user_awards_autocomplete($string) {
    $matches = array();
    $return = db_query("SELECT name FROM users where lower(name) like '" . $string . "%' LIMIT 10");
    // add matches to $matches
    foreach ($return as $row) {
        $matches[$row->name] = check_plain($row->name);
    }
    // return for JS
    drupal_json_output($matches);
}

And submit one:

function user_awards_settings_submit($form, $form_state) {
    $file = '';
    if (isset($form_state['values']['user_awards_block_image'])) {
        $file = file_load($form_state['values']['user_awards_block_image']);

        $file->status = FILE_STATUS_PERMANENT;

        file_save($file);
    }
    $description = $form_state['input']['award_description'];
    $name = $form_state['input']['name'];
    db_query('INSERT INTO {user_awards} (name, award_description, fid) VALUES (:name, :award_description, :fid)', array(
        ':name' => $name,
        ':award_description' => $description,
        ':fid' => $file->fid,
    ));
    drupal_set_message('form has been submitted');

}

I need somehow to make $form['name'] to be multiple(autocomplete) textfield, comma separated or so, how can i do it?
At this moment its only autocomplete first value of NAME field


texts: Pass user_register form field values to Pardot for extra processing

texts:
I need to pass the values submitted during registration to Pardot using a form handler.

How can I accomplish the task?


texts: Is there any way to set a flag field value on flag creation?

texts:
I have a Flag with a boolean field, Happy.  I want to set the value of this field when I flag content programmatically.
My question
Is there a way to set the value of the flag field when creating the flagging?
What I tried
This question asks how to set the custom field programmatically.
The answer suggests using code like this:
  $flagging = $this->flagService->flag($flag, $entity, $this->currentUser);
  $flagging->set('field_happy', $happy_or_not);
  $flagging->save();

This does set the value of the flag field programmatically.  But, it causes the flag to be saved twice-- once when the call to flagService->flag is made, and then again upon $flagging->save();.
Problem I am trying to solve
I wanted to put some custom code in a hook_flagging_insert() to be processed when the node is flagged, but if this code affects the value of field_happy, it won't be set yet.  So I added a hook_flagging_update() and then set hook_flagging_insert() and hook_flagging_update() to call a third function, do_stuff_for_my_flagging().
This has resulted in some complicated logic that could be simplified if there was a way to set the value of the field attached to the flag when creating the flagging.


texts: Add Custom validation with Clientside validation

texts:
Can anyone show me an example for adding custom clientside validation in drupal?
I need to add my custom validation work with client side validation. I want to make it work my custom validation with Clientside Validation Module validation.

Code I have written:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'user_register_form') {
    $form['#validate'][] = '_user_register_form_validate';

    $form['account']['email_confirm'] = array(
       '#type' => 'textfield',
       '#title' => t('Re-enter e-mail'),
       '#required' => TRUE,
       '#weight' => '-3',
       '#description' => '',
     );
}
function _user_register_form_validate($form, &$form_state) {
  if($form_state['values']['mail'] != $form_state['values']['email_confirm']) {
    form_set_error('email_confirm',"E-mail address doesn't match - please try again.");
  }
}

My code is working with normal page submission. What should I do make it work with Clientside Validation?

I have tried some methods that mentioned in the below link. But noting I couldn't make it work.
https://drupal.org/node/1324772

I am using Drupal 7.


texts: Can I use Panels context keywords in PHP functions?

texts:
I'm using the privatemsg module and I would like to display the number of unread messages a user has on his/her profile page.  I attempted to use %user, which is the context keyword for the user currently being viewed.

According to the privatemsg API documentation, the function for this is privatemsg_unread_count().  I tried calling the function like this:

privatemsg_unread_count("%user");

But I get an error: Notice: Trying to get property of non-object in privatemsg_unread_count()

The function takes an account argument, which as far as I can tell (I'm not very skilled in PHP) is an array that stores the values for a given user.  Am I going the wrong way with trying to use the context keywords?


texts: Commerce coupon redemption form into block

texts:
How to load commerce_coupon_redemption_form programmatically into custom block? I have to show the coupon form into a block in cart page.

i try this into my custom block plugin:

public function build() {
      return array(
        '#theme' => 'mycustom_block_template',
        '#content' => array('tot' => 100),
        '#form' => [
              '#type' => 'commerce_coupon_redemption_form',
              '#title' => t('Coupon code'),
              '#description' => t('Enter your coupon code to redeem a promotion.'),
              '#order_id' => 3,
              '#cardinality' => 1,
              '#element_ajax' => [
                  ['redemee-block', 'ajaxRefreshSummary'],
              ],
         ],
         '#cache' => ['max-age' => 0]
      );
}

where into my MYMODULE.module i have:

function MYMODULE_theme($existing, $type, $theme, $path) {
    return [
        'mycustom_block_template' => [
            'variables' => [
                'content' => NULL,
                'form' => NULL
            ],
            'render element' => 'form'
        ],
    ];
}

and my template is

{{ content.tot }}

{{ form }}

i can see the values into content variables but the form is never show.
where is my fault?
thanks


texts: Show contact form in a pop-up window with Bootstrap classes

texts:
Can you please tell us how to create a modal window with a contact form, with the bootstrap classes?

I open the form with

Open form

And why is the modal window not working for anonyms? Thank you!

UPD

Happened!

Connected via theme, at the root of the theme there is a file my-theme.libraries.yml in it, we develop a library

drupal.dialog.ajax:
  version: VERSION
  js:
    /core/misc/dialog/dialog.ajax.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings
    - core/drupal.ajax
    - core/drupal.dialog

Followed by the root theme in the file my-theme.theme Insert function

function my-theme_preprocess_page(&$variables) {
    $variables['#attached']['library'][] = 'my-theme/drupal.dialog.ajax';
}


texts: Create a secondary form to fill data into an entity

texts:
I've an entity that models a contact (I'm using RedHen CRM) and obviously I can fill the data from the usual admin form. But if I want to publish another form for non admin users to insert their data and with less fields displayed, which module (or solution) can I use?
I'm using webform, but I'm having some trouble with addressfield...


texts: Import to Entityform via Feeds? Feeds entity processor module?

texts:
I've built an Entityform and now would like to use Feeds importer to add entries. Feeds does not seem to offer a processor for Entityform. I've done some digging and found the Feeds entity processor module.

Will this module allow me to target my Entityform via a Feeds importer?

The Feeds entity processor page offers this info:

  This module provides a generic processor for all entity types that
  support CRUD operations through the Entity API module.

I've done some digging into this too, but can't quite determine if this will do what I need. If there are other ways/modules that will help, I'm all ears!

FYI: Due to restrictions in my development environment, I can't simply give it try (wish I could!). I need to make requests for new modules to be installed... so I need to be pretty darn sure something is going to do what I need before I make the request.


texts: what can be wrong if my view renders only 4 list elements? I have pager disabled - displaying all items, no offset, $view->total_rows is 21. I have no views alter. Have you any ideas where to find fix for that behaviour?


texts: How can I reset userpoints for a single user?

texts: I know there exists a reset all user points method, but I need to be able to reset points for each single user individually.


texts: Form inside a block that "feels right", theme-agnostic

texts:
I am building an autoresponder-like form that fits a block.

So far i've added title, a body, two input (name and email) and submit button.

While the body feels right and uses the space in the right way, the input boxes bleed out of the block, and are very ugly to see, while the button is aligned to the left.

I've temporaly solved the issue giving "width: 95%;" to both input and "width: 100%;" to the submit button, and allowed the user to change the styles on the configuration page. Unfortunately, this feels a little amateur to me, and I would like to make the form more smart about the space available inside the block.
One thing more, I am looking for a solution that does not care of the theme beign used.

  $form['my_name'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t("Name"),
    '#attributes' => array('style' => $style_name),
  );
  $form['my_email'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t("Email"),
    '#attributes' => array('style' => $style_email),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t($submit_button),
    '#attributes' => array('style' => $style_submit),
  );

As I said above, $style_name and $style_email are defaulted to "width:95%" and $style_submit is defaulted to "width:100%". The items are at least inside the block box, but they are still quite ugly from a design point of view.

As clive pointed out, maybe the solution can be only html/css based, but the issue to me feels quite Drupal specific.

For example, here a screenshot of a drupal form inside a block without any attribute set:

To me, this feels way wrong. If I build a form inside a sidebar on Wordpress, all the items stay inside the content area of the sidebar, without bleeding out, as it feels to me logical to happen.

There is no better solution other than the css/width trick to make this better?
Btw the issue stays to matter what theme is used.


texts: Is it possible to make the Book Outline a mandatory field when creating a new book page?

texts:
I would like to make sure that certain content types always have a parent book/page.

Is there a way to do this, by JavaScript, by modifying the book module or whatever?


texts: Views display settings are in the database but don't show up in views UI

texts:
I'm trying to create a copy of a live site and use it as a test site, but am having trouble with views. There's a view whose settings are in the database but don't show up correctly in the views UI.

I copied the site by (1) installing Drupal, (2) installing the required modules, including some custom features, and (3) exporting the database from the live site and importing to the test site.

The view in question is defined in a feature, and also exists in the views_view and views_display tables in the database. I have not reverted the feature, so I believe the feature code should be ignored in favor of whatever is in the database.

In any case, both in the database and in the feature, the view has an added display with some settings that override the default display. For example, the added display has Header: PHP Code, which overrides the default display's Header: None. In the views UI, the added display exists, but, except for Name, all of its overridden settings, relationships, arguments, fields, and filters are gone. That's also the case for some of the other displays on the view. One display lost its relationships, arguments, and sort criteria, but not its fields and filters.

I've tried clearing all caches (drush cc all), clearing the views cache (Admin > Site Building > Views > Tools), and deleting all rows from the views_object_cache table. Didn't help.


texts: Configuration Management is broken between two site environments, I have no idea how to fix it

texts:
I started working on a d8 site two weeks ago; there are two site environments: @dev and @staging, on different servers. I have been developing the site locally (adding views, pages etc.) and using the configuration exporter to export a compressed config file from @dev which I then import @staging. I occasionally use the single export/import tab to pass configuration upstream.

Mostly it's been working fine until recently. I somehow broke the site when I added a specific view. Now whenever I try to import into @staging i get the same error, regardless of what I'm importing:

  The configuration cannot be imported because it failed validation for the following reasons:
  Configuration views.view.view_name depends on the module that will not be installed after import.

A while ago I created a module (using drupal console) with the purpose of inserting a block, but it failed (probably because I gave the module the same name as the theme I'm developing). I removed this module, but not before enabling it on one or more of the sites - it's the only thing I did that broke the site (prompting a restore from an earlier database version).

I just want to fix the configuration syncing between the two sites, because I can't go on re-configuring both versions of the site for each and every change. That's so D7.

I'd be happy to provide any other information needed to help diagnose/solve the issue. I use git to synchronise themes between the two files, filezilla to copy site files from @staging -> @dev, drush to install any modules (eg. drush en ds) to @dev and git to transfer those changes to @staging. Occasionally I'll synchronise databases from @staging -> @dev (because content entry - handled by another internal team - has begun).


texts: How to handle a node translation containing an entity reference with a managed field property

texts:
I have a custom field that contains a managed file. The node that the field is attached to and the field are enabled for translation.

I create a piece of content, which defaults to the site default language EN. The content contains a managed file, let's say FID 1.

From the admin content screen I select Translate and add a translation. When the node edit form is rendered, it contains the values from the original content as it should, and contains the file information as well, so that I need to remove the original and add a new one.

When I save this version, language ES, both appear on the admin page and in the db. The property for the managed file in ES has FID 2.

The issue is when switching back to English using the language widget on the home page, a 500 is received. The reason is that removing the managed file from the Spanish translation in order to add the correct one resulted in the actual file being removed as well as the FID 1 file_managed table entry, but 1 still remaining in the property value for the managed file in the custom field.

I could probably finagle the custom field widget to not present a default value for the managed file property somehow in the case of adding the node, but that seems wrong, because it's possible that the user to leave the file the same.

Is there a standard way to handle this?


texts:
How do I debug permissions in Drupal 7?

I use core reporting, error logs, devel module error logs, backtrace and node access permission block but sometimes it is not enough.
What else should I check to find out why certain fields, views or blocks are not showing to a user?

I also found there is a module for Drupal 6 for reporting on permissions called  but it is not available for Drupal 7.

I am using various permission related third-party modules:

 - devel node access 7.x-1.x-dev
 - fast permissions administration 7.x-2.0
 - organic groups access control 7.x-1.x
 - profile2 group access 7.x-1.x-dev
 - ur-node access 7.x-1.x-dev


texts: Unable to store value of an property or entity key in ConfigEntityType form

texts:
I have a propay_account_number in config entity type which I am unable to save using the below code.
What is incorrect and how can I fix it to make it work ?

src\Entity\PropayAccount.php

namespace Drupal\propay_api\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBase;

/**
 * Defines the Propay Account entity.
 *
 * @ConfigEntityType(
 *   id = "propay_api_account_number",
 *   label = @Translation("Propay"),
 *   handlers = {
 *     "list_builder" = "Drupal\propay_api\PropayAccountListBuilder",
 *     "form" = {
 *       "add" = "Drupal\propay_api\Form\PropayAccountCreateForm",
 *       "edit" = "Drupal\propay_api\Form\PropayAccountRenewForm",
 *       "delete" = "Drupal\propay_api\Form\PropayAccountDeleteForm",
 *     }
 *   },
 *   config_prefix = "account_number",
 *   admin_permission = "administer site configuration",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label",
 *     "propay_account_number" = "propay_account_number"
 *   },
 *   config_export = {
 *     "id",
 *     "label"
 *   },
 *   links = {
 *     "edit-form" = "/admin/config/development/propay-api/account-number/{propay_api_account_number}",
 *     "delete-form" = "/admin/config/development/propay-api/account-number/{propay_api_account_number}/delete",
 *     "enable" = "/admin/config/development/propay-api/account-number/{propay_api_account_number}/enable",
 *     "disable" = "/admin/config/development/propay-api/account-number/{propay_api_account_number}/disable",
 *   }

 * )
 */

class PropayAccount extends ConfigEntityBase {

    /**
     * The Propay ID.
     *
     * @var string
     */
    protected $id;

    /**
     * The Propay Label.
     *
     * @var string
     */
    protected $label;

    /**
     * The Propay Account Number.
     *
     * @var string
     */
    protected $propay_account_number;

    public function id() {
        return $this->id;
    }

    public function label(){
        return $this->label;
    }

    public function getAccountNumber() {
      return $this->propay_account_number;
    }

}

config\schema\propay_api.schema.yml

propay_api.account_number.*:
  type: config_entity
  label: 'Propay Account Number'
  mapping:
    id:
      type: string
      label: 'ID'
    label:
      type: label
      label: 'Label'
    propay_account_number:
      type: string
      label: 'Propay Account Number'

src\Form\PropayAccountCreateForm.php

    <?php

    /**
     * @file
     * Contains \Drupal\propay_api\Form\PropayAccountCreateForm.
     */

    namespace Drupal\propay_api\Form;

    use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Form\FormStateInterface;

class PropayAccountCreateForm extends EntityForm
{

    public function form(array $form, FormStateInterface $form_state)
    {
        $form = parent::form($form, $form_state);

        $entity = $this->entity;
        $form['id'] = [
            '#type' => 'textfield',
            '#title' => $this->t('ID'),
            '#required' => TRUE,
            '#default_value' => ($entity->id()) ?? '',
        ];

        $form['label'] = [
            '#type' => 'textfield',
            '#title' => $this->t('LABEL'),
            '#required' => TRUE,
            '#default_value' => ($entity->label()) ?? '',
        ];

        $form['propay_account_number'] = [
            '#type' => 'textfield',
            '#title' => $this->t('Propay Account Number'),
            '#required' => TRUE,
            '#default_value' => ($entity->getAccountNumber()) ?? '',
        ];

        return $form;
    }

    public function save($form, FormStateInterface $form_state)
    {
        $entity = $this->entity;
        $entity->set('propay_account_number', $form_state->getValue('propay_account_number'));
        $entity->save();
    }
//event tried formSubmit() but it did not help save the values in propay_account_number

}


texts: How to trace Drupal 7 Core Logic Using Netbeans with xdebug?

texts:
I'd like to understand how Drupal core works by tracing core logic and how functions unfold. I installed Netbeans with xdebugger and started a new project. The project includes drupal installation run on localhost. I read several Netbeans quickstart manuals and began studying core by putting breakpoints. But when I start debugging the project they do not seem to work. Please explain any productive approach for studying drupal 7 core logic using Netbeans with Xdebug?

Thanks!


texts: Generate hyperlink on each row for html table that contains database data

texts:
I created Ajax based dependent dropdown list and based on the selected item I selected table from database and displayed html table as output.

Now I want to generate hyperlink for each row of html table .This hyperlink is used to access public files based on the fid

I think i cannot use views because i am generating html table based on selected item from dropdownlist

I would be more thank full if anyone can share some ideas


texts: Ajax dependent drop down not working on form rebuild

texts:
I have a drupal custom form with two ajax dependent dropdown fields and five normal text fields. on form submit, all things are working fine except validation of form fields. when I put validations on form fields with validate function is working but ajax fields are losing their values. where is the exact problem? I am stuck here.(Using Drupal 8.6.10)
Thank you in advance.


texts: Adding third parameter to ViewExecutable doesn't work

texts:
I've created a Controller to get all content teaser of a specific type and in a specific language.

namespace Drupal\xxxxxx\Controller;

use Drupal\Core\Controller\ControllerBase;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

use Drupal\views\Views;

class ContentTeaserController extends ControllerBase {

public function getTeaser(Request $request) {
    $params = [];

    $quantity = $request->query->get('quantity');
    $nodetypes = $request->query->get('nodetypes');
    $tags = $request->query->get('tags');
    $style = $request->query->get('style');
    $page = $request->query->get('page');
    $language = $request->query->get('language'); // <---

    $view = Views::getView('contentteaser');
    $view->setDisplay($style);
    $view->setItemsPerPage($quantity);
    $view->setOffset($page * $quantity);

    $arguments = [
        (($tags) ? $tags : '*'),
        (($nodetypes) ? $nodetypes : null),
        (($language) ? $language : 'en'), // <---
    ];
    $view->setArguments($arguments);

    $view->execute();
    $result = $view->result;

    $renderableView = $view->buildRenderable(null, array('language' => $arguments[2]), false);

    $renderableView['#embed'] = TRUE;
    $content = \Drupal::service('renderer')->render($renderableView);

    $response = new Response();
    $response->setContent($content);
    return $response;
  }

}

I only added the two lines marked by // <---.

So when I call the route i configured for this controller, I only get the results in German.

I also tried to set the arguments statically by replacing the $arguments array by

$arguments = [
        #(($tags) ? $tags : '*'),
        #(($nodetypes) ? $nodetypes : null),
        #(($language) ? $language : 'en'),
        '*',
        'employee_article+event+news',
        'ru',
    ];

I must add; When I'm configuring the view in the Drupal backend and use the live preview at the bottom of the page, everything works fine.

My thought is, that it's the renderer that doesn't work properly.

This is the configuration of the View.


texts: How do you pass more than one node to a route?

texts:
I am working on converting a drupal 7 site to drupal 8 for some practice with 8. In my drupal 7 site, I have a custom hook_menu declaration with the following:

function solution_menu() {
  $items = array();
  $items['solution/%node/%node/%node'] = array(
    'title' => '',
    'page callback' => 'solution_build_solution',
    'page arguments' => array(1,2,3),
    'access callback' => 1,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function solution_build_solution($solution_node, $species_node, $problem_node) {
   //build solution
}

I am trying to accomplish the same thing in drupal 8 with a route. However, if I try something like the following i get an error:

wlh_decision.solution:
  path: '/solution/{node}/{node}/{node}'
  defaults:
    _content: '\Drupal\wlh_decision\Controller\SolutionController::displaySolution'
    _title: 'Solution:'
    _title_callback: '\Drupal\wlh_decision\Controller\SolutionController::solutionTitle'
  requirements:
    _permission: 'access content'

The error i get is:

LogicException: Route pattern "/solution/{node}/{node}/{node}" cannot reference variable name "node" more than once. in Symfony\Component\Routing\RouteCompiler::compilePattern() (line 106 of /Users/brianwilliams/Sites/MAMP/drupal8/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php).

but if i change it to use names other than node, I don't get the autoloading.

Anybody know how I am able to handle this?


texts: Getting an fatal error message when trying to render custom blocks on my node twig template

texts:
I'm trying to render or print my custom blocks on my node twig template and currently receiving a fatal error message.

Argument 1 passed to Drupal\block\BlockViewBuilder::view()

Here is the snippet of code I'm working on my .theme file

function iom_preprocess_node(&$variables) {

    $block = \Drupal\block\Entity\Block::load(917);
    $block_content = \Drupal::entityTypeManager()
      ->getViewBuilder('block')
      ->view($block);
}

$block returns NULL when I try to do a dump($block)

$block = \Drupal\block\Entity\Block::load(917);
dump($block);

Tried using twig tweak also to resolve the issue instead of having to pre-process it but no luck

{{ drupal_block('twitterfeed') }}


texts: How can I make a link to a node obtained from an SQL query?

texts:
I'm trying to make a module for a users profile page which shows all of the content of certain types they have created. I have got the query to work and list the results in a block - however I can not get the returned list to contain links to the nodes. Here is my code:

function get_articles()
{
  if(arg(0) == 'user' && is_numeric(arg(1)))
  {
    $account = user_load(arg(1));
  }

  $result = db_query('SELECT node.title FROM {node} node WHERE (( (node.uid = :uid) AND (node.status = \'1\') AND (node.type IN (\'article\')) )) ORDER BY `created` DESC LIMIT 5', array(':uid' => $account->uid));

  if($result->rowCount() > 0)
  {
    $list = array(
      '#theme' => 'links',
      '#links' => array(),
    );

    foreach($result as $record)
    {
      $list['#links'][] = array('title' => $record->title, 'href' => $account->name . '/' . $node->title);
    }

    return drupal_render($list);
  }
  else
  {
    return t('This user has no Articles.');
  }
}

Thank you in advance to anybody who answers.


texts:
I have the following set up:

Webform "my_webform"
Entity type "activity"
The "activity" entity type includes a webform reference field
Activity ID 14 has some content and a reference to "my_webform"
Activity ID 14 has the path "/activity/14"

In a custom module I have a hook_form_alter() to perform some changes based on certain conditions. I'm using the devel module and kint() to debug the structure.

function MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id === 'my_form) {
    kint($form['#action']);
  }
}

Here's the first bit of strangeness:

kint() states the length of the string as being 55 characters. To work out what the characters are, I used the following:

function MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id === 'my_webform) {
    $array = [];
    for ($i=0; $i<strlen($form['#action']); $i++) {
      $array[$i] = $form['#action'][$i];
    }
    kint($array);
    print implode(' ',$array);
  }
}

This produced the following:

f o r m _ a c t i o n _ p _ p v d e G s V G 5 z N F _ X L G P T v Y S K C f 4 3 t 8 q Z Y S w c f Z l 2 u z M

To get a proper look, I tried to remove this spaces:

print str_replace(" ", "", 'f o r m _ a c t i o n _ p _ p v d e G s V G 5 z N F _ X L G P T v Y S K C f 4 3 t 8 q Z Y S w c f Z l 2 u z M');

The result:  /activity/14

The full hook_form_alter():

function MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id === 'my_webform) {
    $array = [];
    for ($i=0; $i<strlen($form['#action']); $i++) {
      $array[$i] = $form['#action'][$i];
    }
    kint($array);
    print implode(' ',$array);
    print str_replace(" ", "", 'f o r m _ a c t i o n _ p _ p v d e G s V G 5 z N F _ X L G P T v Y S K C f 4 3 t 8 q Z Y S w c f Z l 2 u z M');

    // exit;
  }
}

Uncommenting the exit; results in the full 55 character string so something's happening after this hook_form_alter() is invoked. Where and how this is happening? How does it alter what print displays after the fact?

I've hardcoded the string in str_replace() for testing but this can be replaced with print implode('',$array);


texts: DB Query exclude duplicates, returning only the newest

texts:
I need to alter the query below to only return one row for each unique 'name'. The row returned should be the most recent based on the contents of 'date'. 'date' is an integer.

$query = db_select('updates_summary', 'n')
->fields('n', array('upid', 'name', 'date','previous_version','new_version'))
->orderBy('date', 'DESC') //Most recently updated first.
->execute();
return $query;

I have looked at the Drupal page on Expressions, another Drupal answers question and questions on drupal.org like this and this. Unfortunately I am new to the db-api and am struggling to get anywhere.

This works to return a single date but nothing else in the other columns:

  $query = db_query("SELECT MAX(upid) as max_id FROM updates_summary")->fetchCol();
  return $query;
}

NEW ADDITIONS:

This is the mySQL query I need an equivalent of:

SELECT `name`, MAX(date) FROM `updates_summary` GROUP BY `name`

Adding ->groupBy('name') to my query seems to do what I need it to. However, i am confused as to why this seems to be working without specifying that I want to return the maxium from the date column. My current code that seems to work is:

  $query = db_select('updates_summary', 'n')
->fields('n', array('upid', 'name', 'date','previous_version','new_version'))
->groupBy('name')
->execute();

return $query;

I would like to add a MAX(date) as I did in the mySQL statement above. This answer suggests that adding the following should work: ->addExpression('MAX(date)', 'max_date') but i get Fatal error: Call to a member function fields() on a non-object.


texts: Views, show block on nodes where the node author has specific role(s)

texts:
I am trying to display a few views blocks on nodes of authors that have specific roles. So far I used contextual filter Content: Author uid with the following settings:

Provide default value: User id from url (Also look for a node and use the node author checked)
Specify validation criteria: validator user, Restrict user based on role checked and I checked the roles for which I want the block to show up.

Although it seems to work with some blocks, it does not with all.

A good example is this page. The Featured listings block has the same settings (contextual filter as described above) as the Similar listings one but it does not show up. I used the same filter for another page (diff role of the author) with exactly the same config except the role and seems to work fine as well.

Any idea anybody how this could work for all use cases? Is content author uid the correct filter and is the setup correct?

Any help will be much appreciated.

THanks


texts: How to disable a language while still being able to create content for it

texts:
I have a website with already 2 languages. I want to add a 3 one, but I obviously don't want it to be accessible until it is finished. If I disable to language, I can't create content in it anymore.

Anyone has a suggestion?

Thank


texts:
I have a pretty basic Drupal 7 web site with Solr search (works great!).

I would now like to perform some "work" after each node is indexed with Solr.

First I tried creating a workflow rule but there is no event for "node has been indexed". Next I looked for Solr API hooks but came up empty handed.

Should I look at adding a hook somewhere in the PHP code? If so where? Or am I overlooking a more obvious solution?

Thanks


texts: Integrate Radioactivity with Apache Solr (sort by popularity)

texts:
Has anyone integrated integrated Radioactivity with Apache Solr?

I'm using the apachesolr module for search and would like to add the ability to sort by popularity. The Radioactivity module assigns points to a module based on 'hotness' (fivestar ratings, comments, views, etc). I want to submit the points Radioactivity gives a node to Solr to use as a popularity index.

I believe that means I'll need to modify the schema.xml file on the Solr end and add some sort of hook on the drupal end. Can anyone point me in the right direction?


texts: How to insert a text field inside boolean (single on/off) field in node form

texts:
I have created a a content type and I am using it as a registration form to be created by anonymous users.

When I create a field with type of boolean> single on/off checkbox
for my terms and conditions (where it will display the terms and they will be required to check the single checkbox if they agree).

My problem is i want to add another text field for this particular field type in node form for me to put in the text for terms and conditions.

There is a help text box there which i can use, but i used it to display tooltips.

What is the best way to add another text field to boolean type field in node form?


texts: ThemeKey: Use main theme for Node/edit and user/edit

texts:
By default, Drupal uses the "main theme" for the main site, and the "admin theme" for the admin pages.

I want to use my "main theme" for the user/edit pages and node/edit & node/add pages of the "journal" content type only.
For all other administration pages (including the node/edit & node/add pages of other content types) , I want to use the "admin theme".

How can I do this? In Theme Key there doesn't seem to be options to select node/edit & node add pages of a particular content type (or options to select user/edit pages).


texts: Tell taxonomy links to use route in custom module

texts:
I have a module where I created a route /page/tag/{term} that uses a controller for modifications to how the term page is handled.

The problem is that when any page displays these term links, they don't use the custom route, but the default /taxonomy/term/{id}.

How can I tell the taxonomy term links to use my custom route?

Adding the path as the term alias skips over the custom route entirely.

OR, how would I get rid of the custom route and create a pathauto pattern using the same path, but tell those pages to use my custom controller?

I have tried both methods without success...

Here is what I've tried with modifying the existing route:

modulename.services.yml

services:
  modulename.route_subscriber:
    class: Drupal\modulename\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber, priority: 100 }

modulename/src/Routing/RouteSubscriber.php

namespace Drupal\modulename\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

    /**
    * {@inheritdoc}
    */
    protected function alterRoutes(RouteCollection $collection) {
        if ($route = $collection->get('entity.taxonomy_term.canonical')) {
            // i've tried both of these
            $route->addDefaults(['_controller' => '\Drupal\modulename\Controller\ListController::list_by_tag' ']);
            $route->addDefaults(['_title' => 'test']);
        }
    }

}

Edit: after seeing this, I thought about keeping my custom route and using the alterRoutes to change the links...

$route->setPath('/page/tag');

That worked, but it adds on ?taxonomy_term=123

How can I get the term name into the url? /page/tag/term

Update:

Still can't figure out how to get the term name from the route (without loading the taxonomy entity - I'd imagine that is too much load)

Also, I will need to make sure I'm in a specific vocabulary before changing the route.

Any ideas?


texts: Is it true that CCK has no API to work with from other modules?

texts:
A colleague of mine was trying to import some huge data (from Excel) into a drupal 6 project with pure PHP and MySQL. The result is supposed to be few content-types(CCK), thousands of nodes(CCK nodes I mean),some vocabularies and few other things.

Seeing him trying to decipher the tables involved, I suggested instead of trying to reverse-engineer what CCK is doing, he should use CCK API. The problem is I couldn't find any such thing as CCK API!

Despite my heavy search to no avail, I can't in any right mind believe this to be true. I say, to myself, perhaps I can't find it ?

So how do you add a content-type, a CCK node etc etc Pragmatically ?
How do you utilize CCK in PHP code ? not from the user interface ?


texts: Read opengraph property and use as field title

texts: I have a simple site that generates an article content in the page. This content is a link preview of the article URL. My goal is when an article is created I want to use metatag property sitename as the author of the post, e.g. <meta property="og:site_name" content="ABC">, then the author shall be ABC. I actually want to achieve this using Rules. My inital question is how can I programmatically read/access opengraph property from an external link and assign it as user/author of the post?


texts: How do I echo the node vocabulary in preprocess_page or in page.tpl.php so that I can test against it in Drupal 7?

texts: I need to be able to echo the vocabulary that is associated with a node, but I need to echo it either in the preprocess_page function in template.php OR somewhere in page.tpl.php. I can't seem to find how exactly this will work in Drupal 7. Does anyone know?


texts: Single page Drupal apps with custom theme

texts:
I have a static HTML page which contains navigation that links to different sections on the same page. Just like this one http://www.cedricvella.com/#node-3 .

What I would like to know is how can this functionality be built with Drupal when creating a custom theme. I don't want to use Panels.

Is there a way you can pull each page node into one single page?


texts:
I have a controller that renders page elements. I have a php variable of type png image. What is the proper way to render it?

My code:

public function buildPage() {

    $page = [];

    $block_manager = \Drupal::service('plugin.manager.block');
    $config = [];
    $plugin_block = $block_manager->createInstance('my_custom_block', $config);

    $page['element_one'] = $plugin_block->build();

    $page['element_two'] = array(
      '#type' => 'markup',
      '#markup' => $this->t('This is the second page element'),
    );

    //How to render this on a third page element?
    $image = 'test.png'

    return $page;
  }

Thank you


texts:
Has anyone been able to figure out how to notify the node author when new comments are posted on their content?

I understand Rules for Drupal 8 is still in its infancy.  When I used various tokes for the TO filed nothing worked.

If anyone could share their solution that would be great.


texts: drush 6.2.0 reports no version control found for core updates, but DOES find and use svn for module updates (pm-update)

texts:
for drush 6.2.0, when running:

drush pm-updatecode --version-control=svn --svnsync --svncommit

on a drupal 7 site that only needs module updates, drush will properly commit the changes to svn as expected:

Project committed to Subversion successfully

however, if the site has a core update, drush will report:

No valid version control or backup engine found (the --version-control option was set to "svn").

and fail. does anyone have any idea why this is occurring, or what i should do to fix it?


texts: Remove the language prefix from file URL

texts:
More specifically url's to files in the body text.

So in my body text I have manually added

some file

to link to a file.
I'm using the Pathologic module which changes every url to use the correct base path and language prefix. But it also adds a language prefix to files I've linked to in my body text. This obviously breaks the link to the file.

I realise there are some ongoing multilingual issues with the Pathologic module but to my knowledge these aren't fixed yet.

So now I'm looking for a workaround that allows me to remove the language prefix from the url for links that contain /default/files/.

Is this possible in .htaccess with mod_rewrite? If you first check if the url contains /default/files/ and then do a redirect or rewrite the url?
Is there some hook you can use that can alter the url?
Is this possible with the Pathologic module? I noticed in the API there's a hook_pathologic_alter function but the path it provides as an argument seems to be the part after the language prefix. I don't know if you can alter the first part.

Thank you in advance, any help is very much appreciated!


texts: Quantize/dither image using ImageMagick commands on image style actions

texts:
Is there a way to use custom imagemagick commands on a image style action.
I'm trying to create a dither effect like the ones shown on the examples on the imagemagik site: http://www.imagemagick.org/Usage/quantize/#dither.

Here's another example: http://caca.zoy.org/study/out/lena5-2-1.png.

The command on the imagemagick website looks like this:

  convert colorwheel.png -dither Riemersma      -colors 16 dither_riemersma.gif

plus

  convert  logo.png  -remap pattern:gray50  mono_remap.gif
  convert -size 15x640 gradient: -rotate 90 \
                   -remap pattern:gray50     mono_remap_gradient.gif

but I don't know how or if it is possible to add this to an action.

Can someone shed some light on this? Is there an alternative method to accomplish this?


texts: How can I dynamically modify the text of the Global: result summary?

texts:
I'm using the Views module to displays search result. In the header of the views, I added the Global: Result summary to show result summary.

 "@total Results (@per_page per page)"  //Output: 25 Results (20 per page)

But depending on search result count the **Global: Result summary text should change. Meaning I want to dynamically change the text based on the search result count. For example, if total search result count is less than 10(configured Items to display)), then result summary text should be displayed like below.

 "@total Results"
  Output: 5 Results

How can I achieve that that?


texts: Creating some views fields for a taxonomy menu with the active trail CSS classes?

texts:
I have a taxonomy vocabulary which I want to use to create some navigation on my site.

Terms:

Weather
Clothes
Calendar
Sports

I want to be able to pull these terms and put them in the  navigation of the site. However, I want to be able to rewrite the links that these terms go to, so that rather than going to the taxonomy terms default page they go to:

/topic/[insert_taxonomy_term_here]/step-2

This is because I have a view with the [name] of the taxonomy term using that term as a contextual filter.

I'm having no problem creating such a menu tree in Views, but when I grab the taxonomy terms, as a views field, they are output without the standard Drupal active trail css classes, so that I cannot style them to show them as active.

Is there a way therefore to create a taxonomy menu in views in which the fields output the Drupal active trail?

D7 - with latest updates - 27th Oct 2013.


texts: How To Hook To Commerce Add To Cart Button After Add?

texts:
I'm trying to ask the same question in another way... hoping I can get an answer.

I have a function I need to trigger AFTER the product is added to the cart.

When I added a PHP function to a Pricing Rule it seems to execute -before- the product is added.

The Commerce website says that the a Pricing Rule may be triggered before or after the line item is added but I can't figure out how to do this.


texts: Attaching Conditional widget on Drupal Field

texts:
I have extended drupal user registration form by attaching fields to user entity.

One of the field is to let user select duration. I have set it up as radio button.

Form: When you started:

(radio button) Not yet started (need help)

(radio button) Just starting (1-2 years)

(radio button) Traction: (2-3 years)

(radio button) Experienced: (4+ years)

(radio button) We started our CI program in: (field for year)

Now the requirement is if the user select any of the top 4 options it shoudl go as it is. But if none of the above suites users choice than he will select the last radio button and on this radio button he should be able to type his year manually. So basically a text field should appear. I've no clue how to achieve this and didn't find it on google too.


texts: Replace YouTube URL with player in nodes and comments?

texts:
Is there a module or something similar I can use to replace a YouTube URL with the actual video in a node and also in comments?

I've found a few that work for the node, but what about in comments as well?


texts: does indexing tables have a bad effect on drupal?

texts:
I have one or two views which has a lot of fields to show and all of this fields are in filter criteria as exposed filter. now the problem is acting in low speed.

the solution I am now thinking about is to index some fields which are more in use as filter criteria. But I don't know if it has any bad effect on performance or not. Or does it effect views automatically or I should rebuild all views to see the indexing result.

please let me know more about indexing tables in drupal or if you know any better solution let me know!


texts: How do I enable dynamic favicons in a custom theme?

texts: So, I'm working on a site that I didn't build and I'm trying to figure out how to get the favicons working. The site has favicons enabled in the theme settings folder as well as through the themes settings UI, however no favicons are showing up. From what I read, this should just be a question of putting the favicon in the theme root folder. The issue is that I have a bunch of favicons that are meant to be served dynamically (e.g. different devices/sizes, etc) from a subfolder of my theme e.g. themes/custom/mytheme/assets/images/favicon. I haven't dug too far into this yet, but I assume that there's a script somewhere that deals with this. So, how or what do I do to enable my favicons?


texts: View listing page/block relationship configuration

texts:
I have a Part-Time Course content type that holds information about whatever course that needs to be added to the site.

I then have a Part-Time Course Offerings content type that has two fields.
Course Reference, which is an Entity Reference and links it to the Part-Time Course content type mentioned above and Course Offerings, which is an Entity Reference Revisions field type that gets fields from my Part-Time Offering paragraph type. That paragraph type holds various fields including Status and Season.

I have a block view that places the part-time course offerings on each part-time course content type page below the content based on contextual filters of Course Reference based on Content ID from URL.

What I'm now trying to do is create a Course Listing page that lists all the Part-Time Courses that I have but I want to filter it to only show courses that currently have Offerings available. So, if a course doesn't have an Offering available, I don't want it to show up on this listing page. I also want to be able to filter by status and season.

I have a feeling this has to do with Relationships but no matter what combination I've tried, I can't seem to get it to work.

Any suggestions?

The structure is basically like below:

Course - Part-Time (Content-Type)

    --> Course - Part-Time Offering (Content-Type)
        - field_course_reference
        - field_course_offerings

          --> Part-Time Offering (Paragraph)
              - various fields including Status & Season

EDIT: See below answer for an update.


texts: drupal 7 frontpage image scroller: getting image URL in overwritten view template?

texts:
I am creating a frontpage image scroller. I have created a new content type with a title, blurb and image field, and created a view block and set it up on the frontpage. All good so far; this works.

I obviously want to use some javascript and custom HTML to create the image scroller so I have overwritten the views 'row style output' template (views-view-fields--content-type-for-scroller--block.tpl.php). This template is getting picked up correctly and I can customize my 3 fields.

The problem is that the output from the image field:

$fields['myimage_field']->content

includes markup for the image, similar to:

whereby I only want it to output the Image src so that I can use the image as a background to another element.

I'm not too familiar with Drupal 7 but I image somewhere 'further up' I need to overwrite what sort of output I want for that particular field using some preprocessor but I'm not sure how to do this? Or is there a better way in general to be doing this?


texts:
I have a field in my view and I have rewritten the result (  p align="left" [field_about_us_read_more] ) and also check the "Output the field as a link". in styling setting section, "Customize field HTML" is "None" and "Customize field and label wrapper HTML" is "DIV"
the html code generated is like this:

         read more

How can I get rid of the first anchor link?
and how to add extra html element in the " styling setting ".

TNX


texts: How do I add a webform to my Event content type View

texts: I'm using the Date module to create custom Event content types.  I'm using Webform to create registration forms for each event.  I've created a View that displays events in a table based on start date/end date.  I would like to add a link to the corresponding webform to the event in the View. Is there a way to do that? (Using D7 with all modules updated.) I thought I would need a relationship, but the webform is not available.


texts: Specifying CCK Field for Filter Processing

texts:
In Drupal 6, I have a custom filter, and I would like it to process a field other than the body field, depending on the content type. Is it possible to have it process other fields?

For example, for a page I'd like hook_filter() to be passed the body field as $text, but for a custom content type, I'd like it to be passed a different field. Is this possible?


texts: Permissions checkboxes have disappeared on the Admin page for administrator users

texts:
All of the checkboxes on the Permissions page (/admin/people/permissions) have disappeared.

I see the permissions for a split second as the page loads before they disappear, so I think this is a Javascript or CSS issue.

Also, if I edit a single role's permissions (i.e., /admin/people/permissions/3), the checkboxes are there. This only happens when using the main permissions page.

Example of the disappearing checkboxes:

What I've done

I've switched my theme and admin theme to Stark to make sure my theme wasn't hiding the permissions.
I was using the jQuery Multi module to upgrade jQueryUI for some custom scripts, so I disabled that.
I've searched if anyone else has had this issue, and the only thing I've found is https://drupal.org/node/1649186. I'm not familiar with Organic Groups, and I haven't renamed any machine names, so that post didn't get me very far.


texts: VBO Custom Operation to create pdf of selected nodes detail page

texts:
I need to create an vbo action to produce a seperate document (pdf) of every selected node's detail page (node--content.tpl.php).

What i have to do for that..??

Right now i am creating simple pdf with dummy variables to check pdf is generate or not,

For that i done the following code

function MYMODULE_action_info() {
    return array(
        'export_pdf_bulk' => array(
        'type' => 'entity',
        'label' => t('Export PDF'),
        'configurable' => FALSE,
        'behavior' => array('view_property'),
        'triggers' => array('any'),
        ),
    );

function export_pdf_bulk(&$entity, $context) {

$html = '';
$html.="
";
$html.="
Testing
";
$html.="
Dear Sir/Madam,
";
$html.="

";
$html.="
Testing string Here
";
$html.="

";
$html.="
Details are as follows:
";
$html.="

";
$html.="
";
$html .= '';

pdf_using_mpdf_api($html, "Track grievances");
}

Using this code to generate dummy pdf (Use MPDF for generate pdf https://www.drupal.org/project/pdf_using_mpdf) for selected content, i got the ajax error and in error pdf content is displayed in junk characters, but ajax code is 200 and status is ok, then why pdf is now downloading and display in ajax error in junk characters??


texts: How can i export single content node (or) selected content nodes using drush command

texts: I am using drupal 7. i created three basic pages name it as node1, node2, node3 when i export node using node-export-export command all pages(node1,node2,node3) as in one xml file. my intention is to export and import each node (or) selected nodes at a time. Please help me. Thanks for your help.


texts:
For ref, I'm working on https://www.drupal.org/project/focal_point/issues/3162218
I have a twig file that handles the contents of a modal window and I want to load a particular CSS file whenever this twig file is loaded. I've added the following to the top of the .twig:
{{ attach_library('focal_point/drupal.focal_point_preview') }}
...and in my libraries.yml I have:
drupal.focal_point_preview:
  version: VERSION
  js:
      js/focal_point_preview.js: {}
  css:
    theme:
      css/focal_point_preview.css: {}

If I put the attach_library() call in another (inappropriate) template the js/css is present on the page before the modal is loaded and therefore it works properly, but this is not the correct place for these libraries to be added since they are only needed when the modal is opened.
At some point in the past this worked but as of now it definitely doesn't. Thoughts?


texts: How to recompute the thread numbers of comments?

texts:
My articles currently have a text field Note, but I would like to get rid of it. Instead, I want these notes to be added as a comment on the article. Therefore, I have created a Rule with the following logic: if the article has a non-empty field Note, then create a new comment with a body equal to Note, set the article's author as the comment's author and set the comment's creation date as the article's creation date; also remove the text inside Note.

That works fine. However, the new comment shows up last in the comment list, instead of first. Apparently, Drupal does not order comments based on their creation date, but computes a thread value and uses this for ordering. Therefore, I am wondering whether one can recompute these threads (based on the comments' creation dates) after all Note fields have been converted into comments. All comments on my site have a node as their parent, because replying on other comments is currently disabled.

I am aware of the following alternative approach: create a View with all the article's comments and order them on their creation date; use this View instead of the default comments list. However, creating yet another View seems to overcomplicate things.


texts: Display nodes under Parent Taxonomy in Views

texts:
I am using Drupal 7, and I created a two-level vocabulary used it as a field for term reference. I created it using
Simple hierarchical select module.

edit : I have my node tagged with both the parent(State field), and child (City field) term.

Location

 - State1
   - City A
   - City B
 - State2
   - City C
   - City D

Then I have a page View, where I use the Location field as an exposed filter, so that visitors can sort the content.

I have no problem in getting the results when the user selects for example:

  Illinois

  Chicago

Then all content that has the term Illinois and Chicago will be displayed.

The problem comes when I only want to sort using the parent term, so if you sort for example using only

  Illinois

It should display every node that has the term Illinois.  But my Views returned nothing, when selecting only the parent term and applying that exposed filter.

I have checked that when you look view the taxonomy of Illinois everything displays properly, but not on the exposed filter in Views.

How will I proceed on displaying the nodes in my Views using exposed filters?


texts: How do I change the output of theme_comment_submitted()?

texts:
How to change the default theme of comment_submitted in drupal?

Input:

$variables['submitted'] = theme('comment_submitted', $comment);

Output

My expected result is

To print the Name in first and time in second.
Should not truncate.

How can this be done?


texts: How to create commerce product content using date repeat entity module?

texts:
I am using date repeat entity module in a content type say Movies to successfully clone the nodes.I also have a commerce product reference field in that content type which is working fine when I am not using repeat date.
I want to be able to create a new commerce product content for each node in the series when using repeat date.(while creating the Movies node I can see product fields like SKU,product title etc.)

For example,
I am creating a new Movies having start as 1st Jan 2016 and end date as 2nd Jan 2016.I want to repeat this event for every Friday till 31st Jan.
Now there will be 5 nodes created automatically.
how do i create a new commerce product content for each of these nodes?

Thanks.


texts: Establish relation between node and gmap marker

texts:
I have a gmap module (https://www.drupal.org/project/gmap) view that serves the map of locations. I also have a list of those locations under the map. I need to establish a relationship - a class, a rel attribute, or something like this, based on the node id, so that when I click the marker, the correct element in the list can be identified.

I tried adding identification to the marker objects so that they can be related to the list items on click. I have tried the hook_gmap() and the theming preprocess functions to add an attribute to the markers and failed.

I have also tried to hook into the Google Maps marker events, but could not do it without overriding the native infobubble events, which I don't want to override.

The actual question:

How can I pass information to markers created with GMap, so that they can be aware of the node id? Some html attribute like class or rel would be ideal. Adding it as a part of icon image path, like image.jpg?nid=1111 would also do the trick.


texts: Rules Add an item to a List overwrites existing data

texts:
I have created a rule to add terms to an existing Term Field. The rule fires correctly, it's adding the Term to the Field. However, it's overwriting all the existing terms within the field.

I have tried to follow the steps from this similar question as well as this Tutorial, however, it's still a no go for me.

More details about my setup:

Vocabulary: Emails (machine name: emails)
Email Field: Email Field (machine_name: field_primary_email), which is a single value field.
Term Reference: Email Term Reference (machine_name: field_email_term_reference)

The requirement is to display Email communication basis of the Email address present in the node [ Contact Content Type].

I have a rule which picks up the primary email & creates a taxonomy term from it. The second rule, assigns the relevant terms basis of the email present in the node. The email address in the node may change, however, the terms are to remain to display the past communication. When the new email is updated in the node, the first rule creates a new taxonomy term basis of the updated email address. When the new term is created, the second rule picks up the term & assigns it to the Term reference field along with the existing ones. It is not to overwrite the terms already present in the field. Basis of the terms present in the node, I can display the email communication.

My rule I created so far (in Rules export format):

{ "rules_update_email_term_reference" : {
"LABEL" : "Update Email Term Reference",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_view" : [] },
"IF" : [
  { "entity_is_of_bundle" : {
      "entity" : [ "node" ],
      "type" : "node",
      "bundle" : { "value" : { "candidates" : "candidates", "clients" : "clients" } }
    }
  },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_email_term_reference" } }
],
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "node:field-email-term-reference" ] },
      "ITEM" : { "current_term" : "Current Term" },
      "DO" : []
    }
  },
  { "entity_query" : {
      "USING" : {
        "type" : "taxonomy_term",
        "property" : "name",
        "value" : [ "node:field-primary-email" ]
      },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "list_add" : {
      "list" : [ "node:field-email-term-reference" ],
      "item" : [ "entity-fetched:0" ],
      "unique" : "1"
    }
  }
]

}
}


texts: How to dynamically manipulate canonical entity URLs

texts:
I've got a project with a multi-user / multi-domain environment. There is one "main" portal like www.myproject.com and for every registered user with a specific custom permission has_personal_subdomain there is a subdomain and a theme with his username, e.g. user johndoe has a subdomain johndoe.myproject.com and this domain is using his custom theme johndoe.
I've already set up all the domains and the theme switching part. All editing/administrative actions are always done on the main portal domain, also users with personal subdomains work on the main portal domain.
The problem are the canonical entity links: When editing nodes, editing is always done in admin theme on the main portal domain, so of course all canonical entity links also point to the portal domain. E.g. for users with a personal subdomain, the canonical links to www.myproject.com/node/123 or www.myproject.com/my-node-url-alias, but I want johndoe.myproject.com/node/123 or johndoe.myproject.com/my-node-url-alias.
What is the best way to dynamically manipulate the canonical entity view links? I'm not asking for a complete code, I'm just looking for the best starting point/hook/event/service to inject my custom logic.
What I want to avoid:
Create a million custom hooks for hook_menu_local_tasks_alter AND hook_form_alter AND hook_views_pre_render AND whatever else...
I do not care about metatags, SEO, duplicate URLs,... I just want a better editor experience with personalized entity view links pointing to the correct subdomain using the correct theme.
I know there is the OutboundPathProcessor, but this seems a bit over the top, as I only want to change canonical URLs and none of the admin links.
Is there a service specifically for generating canonical URLs I can decorate?


texts:
I'm trying to find a way to let users select nodes from views results, and then get information from the selected nodes (such as node ID) for use in my module. This would probably be done in a form.

More broadly, what I'm trying to accomplish is to present users with a list of nodes tagged with a certain term x, have them to select any number of nodes from that list, and then have my module apply another term y to the selected nodes. I can handle that last part, but I'm struggling with creating a list of nodes that users can select from, and then somehow getting the information about the nodes selected that way.

I assumed views are the way to go but after a lot of searching I haven't found a way to achieve this functionality. Can anyone can show me a solution or point me in the right direction?

Thanks!

I'm using Drupal 7, and Views 7.x-3.7

EDIT: If I had the ability to select nodes with checkboxes via a module like VBO, I would like to do something like the following (terrible) pseudo-code:

foreach (vbo_selected_node) {
$node = vbo_selected_node -> node;
$nid = $node -> nid;
$node = node_load($nid);
$node->field_vocabulary_field['und'][0]['tid'] = $termID;
}

I hope that makes sense. Basically I want to take each selected node and apply another term to it.


texts: Views: Output field as a link with URL provided by another field?

texts:
So I have a content type with fields: image_field and url_field.

The view displays the field_image for all items. Now I want the user to click this image and go to the link in url_field on the same item.

If I try to write the output as a link it requires me set a path for field and it will always be the same URL for all items.

How do I tell it to display image_field with URL from it's own url_field?


texts: Panels content not displaying on copied site

texts:
I'm prepping to convert a large D6 site to D7, so I've copied everything from the server to my local Mac, something I've done a bazillion times w/o a problem.  Concurrently, I changed my dev environment from MacPorts to Homebrew, using PHP54 and MySQL from Homebrew along with the native Apache (2.2.22) on the Mac.  What I'm running into is that Panels content isn't being displayed at all.  I've tried two other sites of ours, one with Panels and one w/o Panels, and the one w/o Panels displays fine.

On my panels pages (using 6.3.9 of Panels), all of the panes are filled by Views content panes and nodequeues, so here's what I've done:

checked the nodequeues to make sure they have content (they do),
edited the view itself to make sure content is being returned (it
is).
cleared caches (I actually don't export cache_* table content
when I get the SQL dump from the server)
went through all of my Apache and PHP configs to make sure everything is set up the same.

The code I'm using is identical to the server (both git clones), and this exact same site worked fine before I switched to Homebrew.  Any thoughts on what would keep the panels content from being displayed like this?

Thanks.


texts: Can't remove image from image field on content type

texts:
doing some last minute maintenance on a D7 site. Recently needed to change some of the existing content and am finding that I cannot delete images. In clicking the "Remove" button associated with the field triggers the "doing something" animation with no result. I've modified the image field to no longer required and have flushed the caches. The only thing strange is that I get a
Not Found - 404 - Node view blocked message when viewing the content. No meaningful errors in the watchdog logs.

Update:
The file upload works on my local development machine, but not on the production server. The only error that gets reported is an "invalid X-Frame options"


texts:
In below codes, there is style="float: left;" that make the image float.

Ut scelerisque pulvinar nisi eget ultricies. Fusce iaculis risus vel nunc aliquam hendrerit. Fusce et bibendum justo. In ultricies quam at libero dapibus eu fermentum ipsum eleifend. Proin at libero nulla. Mauris adipiscing, odio vel tempus dapibus, odio dolor pellentesque neque, ac adipiscing enim purus tincidunt mauris. Nunc elementum euismod tellus ut commodo. Aliquam nec felis nunc. Suspendisse et turpis nec purus auctor ultrices sed ut arcu. Mauris suscipit scelerisque tortor, id feugiat sapien lacinia vel. Phasellus congue tellus sed est blandit eu gravida ipsum ultrices. Vestibulum orci leo, condimentum at adipiscing in, scelerisque et odio.

Without HTML filtering, it works. But if using HTML, what tag should I add to make the picture float?

Currently, below is my tags:

  <map> <area>

            <quote>

 <address>   <embed> <object> <param>
 <s> <textarea>