texts: Change Text of Create an Account in Login Block

texts:
I want to change text of Create an account to

something>
Click here

When I print the form I got these values

[links] => Array
        (
            [#markup] =>

Create new account

Forgot your password?

        )

Also, I gave a try in settings.php like

$conf['locale_custom_strings_en'][''] = array(
  '"Create a new user account' => '
somethifn>
Click here',
);

But this prints as a text.

Anybody can help?


texts: Customize views output based on field value using semantic views

texts:
I've inherited a Drupal 7 project that's using Views, Display Suite, and Semantic Views to display a teaser of nodes.

I'm trying to intercept the returned rows from the views teaser list and add a css class based on the value of a field. I've been trying for hours now to edit the 'semanticviews.theme.inc' file, which is where classes are setup/added to the output rows. I can add a class based on the view name but can't seem to get any field data to work with.

The block of code that loops through the view rows starts with;

foreach ($vars['rows'] as $id => $row) {...

And I've tried many things like;

if(($row->field_field_featured[0]['raw']['value'] == 1)) $featured = 'featured';

But nothing seems to work. Using any of the devel functions to see the arrays just crashes the site completely.

I've been working on this issue for almost 3 days straight now and tried many different combinations of code to figure it out with no luck.

Any help would really be appreciated.

Thanks,
Jeff


texts: Can we use math expression in Field collection

texts: I have two fields in field collection i.e total_amount and installment_value. I want to divide total_amount with installment_value and display result in Result field. Can somebody resolve this issue for me as I tried with computed and math expression but unable to resolve the issue. Thanks


texts: Add attributes to options elements in a select box

texts:
I am working with a Drupal 7 site; I have a vocabulary setup with an additional text field. On one of my content-type nodes, this is rendered as a drop-down select box with all the terms under that vocabulary. However, I would also like for the additional vocabulary field to be included as a data-country attribute. It is rendered rendered as follows.

<select id="..." name="..." class="...">
    <option value="145">UK8</option>
</select>

I'd like it to be rendered as follows.

<select id="..." name="..." class="...">
    <option value="145" data-country="United Kingdom">UK8</option>
</select>

Is this possible?


texts: Using paragraphs tag instead of div in fields?

texts:
I have a node type with a body, that I want to display in a custom node template.  When I use code like

print render($content['body']);

I get a mess of div tags like

Here is my body content

I appreciate Drupal's rich markup, but I just want

Here is my body content

According to http://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_field/7 I should be using render(), but it render() doesn't seem to be giving me the control I want.  Is there a best-practice way to do this?


texts: login_destination module and link with anchor

texts:
I want to to use login_destination module to have a link to login screen in comment-wrapper.tpl.php, so after the login, the user came back to write the comment.

I have installed and configured login_destination and modified comment-wrapper.tpl.php.

The login_destination documentation say that if I use my own links to the login screen, i have to use GET to supply "current" parameter.

So in my theme I've added to comment-wrapper.tpl.php:

$destino = drupal_get_destination();
$destino = $destino['destination'];

And changed the text to add the link to the login screen:

<?php if ($comment_form): ?>

<?php print t('Login or anonymous comment:', array('@login' => url('user', array('query' => array('current' => $destino), 'fragment' => 'comments')))) ?>

<?php print $comment_form; ?>

Now, when I click on "Login" link, opens an url like:

SITE.com/user?current=node/3#comments

But after finish the login, I'm redirected to node/3 alias, without the anchor #comments.

If I type on the browser the url:

SITE.com/node/3#comments

It' works ok, it goes to the #comments anchor.

Any help or suggerence?

Thanks!


texts: Running code only once when building a form

texts:
I have built a form using the field API. The function hook_field_widget_form gets called for every field. I have a bit of code that populates a select box but it is being called for every field in the form - see the first 10 lines of the code below.

function mango_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  $library = libraries_detect('d3_custom_scripts');
  if($library) {
    $libs = libraries_get_libraries();
    $custom_scripts_path = $libs['d3_custom_scripts'];
    $files = file_scan_directory($custom_scripts_path, '/.*\.js$/');
    $custom_script_list[''] = t('Please select');
    foreach ($files as $file => $info) {
      $custom_script_list[$info->filename] = $info->filename;
    }
  }
  dpm($items[$delta]);
  $item =& $items[$delta];
  $element += array(
    '#type' => 'fieldset',
  );

  $element['enabled'] = array(
    '#title' => t('Enabled'),
    '#type' => 'checkbox',
    '#default_value' => isset($item['enabled']) ? $item['enabled'] : '',
  );

  $element['custom_script'] = array(
    '#title' => t('Attach script'),
    '#type' => 'select',
    '#options' => $custom_script_list,
    '#default_value' => isset($item['custom_script']) ? $item['custom_script'] : '',
  );
  return $element;
}

Is there a ay to only run the code once and pass in the variables into the hook_field_widget_form function so I can avoid calling the same code over and over when I only really need to call it once?
Many thanks.


texts:
I'm working on a site where much of the back-end is handled by a site-specific custom module.

I have a sidebar region and within

Within module-thing.php is a call to <?php print render($page['sidebar']); ?> to print a region but it is not showing anything despite the region being set with content within the Blocks administration. I'm wondering if this is expected to work from within a module.. is there something i can do to show it?

I found this (right at the top) but doesn't seem to work in drupal 7 http://www.chrischen.me/content/drupal-how-access-regions-blocks-themes-or-modules..


texts:
I have a list of car models from a database. I want to make a View that filters these by make, based on tokens. Eg for the token [cars:make].

I already have the tokens setup, but would anyone know how to actually use these as filters in a View?


texts: (File) File: Path outputs only first item

texts:
I have a view that renders a node page as a view, that node has e.g. 100 images, so technically they are all on same node, so then we go to views fields settings and untick the option to show images in same row. So now each image has it's own row.

Now we add the relationship for file to enable extra fields. We add the File field and it also gets printed next to every image.

Except problem is that it prints the same and only path of the very first image under every other image. It should print the path of each image in the same row.

EDIT: tried the https://www.drupal.org/project/image_url_formatter module, same. It outputs the very same first image field only.

View:


texts: How to apply focus for specific tab in quicktab

texts: I have used quicktabs to search my channels and profiles.I have set default tab "Channels/Videos" in quicktabs setting.When a user enters the text and selects "Profile" tab the focus automatically reverts back to "Channels/Videos".What I want want is,it should remain on the option whichever is been selected("Channels/Videos" or "profile").How can i do this? I also checked by setting the default tab as"none" in quicktabs setting but when a user search for "Channels/Videos"(or "Profile") focus on tab( which is in blue color ) disappears. How can i fix this problem?


texts: Showing local tasks in toolbar with hook_toolbar: caching problem

texts:
I'm creating a module using the toolbar api showing all administrative functions in a more compact toolbar. I'm having "cache" troubles showing the local tasks in the toolbar... How can I keep these items outside the toolbar cache?

In my custom module I use hook_toolbar to add the local tasks

/**
 * Implements hook_toolbar().
 */
function compact_toolbar_toolbar() {

    $items = [];
    ...

    $tasks = _compact_toolbar_local_tasks();
    $items = array_merge($items,$tasks);

    return $items;
}

And a function to generate the toolbar local tasks...

/**
 * Create local tasks toolbar items
 */
function _compact_toolbar_local_tasks() {

    $items = [];
    $route = \Drupal::routeMatch()->getRouteName();
    $manager = \Drupal::service('plugin.manager.menu.local_task');
    $primary = $manager->getLocalTasks($route, 0);

    foreach($primary['tabs'] as $key => $tab) {

        // add toolbar tab
        $items[$key] = [
            '#type' => 'toolbar_item',
            '#cache' => [ // Can I overrule the toolbar cache here?
                'max-age' => 0,
            ],
            'tab' => [
                '#type' => 'link',
                '#title' => $tab['#link']['title'],
                '#url' => $tab['#link']['url'],
                '#access' => $tab['#access'],
                '#attributes' => [
                    'title' => $tab['#link']['title'],
                ],
            ],
            '#weight' => $tab['#weight'],
        ];

        // check if task is active
        if($tab['#active']) {
            $items[$key]['tab']['#attributes']['class'][] = 'is-active';
        }

        // get secondary tabs for each primary tab
        $route = $items[$key]['tab']['#url']->getRouteName();
        $secondary = $manager->getLocalTasks($route, 1);

        // get secondary tabs as tray
        if (!empty($secondary['tabs'])) {

            $links = [];
            $items[$key]['tab']['#attributes']['class'][] = 'toolbar-parent';

            // create renderable array of secondary links
            foreach ($secondary['tabs'] as $skey => $stab) {
                $sname = substr($skey, strrpos($key, '.') + 1);
                $links[$sname] = [
                    'type' => 'link',
                    'title' => $stab['#link']['title'],
                    'url' => $stab['#link']['url'],
                ];
            }

            // add tray with secondary tasks
            $items[$key]['tray'] = [
                '#heading' => t('Secondary tasks'),
                'toolbar_secondary_tasks' => [
                    '#theme' => 'links__toolbar',
                    '#links' => $links,
                    '#attributes' => ['class' => ['toolbar-menu']],
                ],
            ];

        }

    }

    return $items;
}

When I disable the cache in hook_page_top in core/modules/toolbar/toolbar.module everything works like a charm. Otherwise my custom items won't follow the current page...

/**
 * Implements hook_page_top().
 *
 * Add admin toolbar to the top of the page automatically.
 */
function toolbar_page_top(array &$page_top) {
  $page_top['toolbar'] = array(
    '#type' => 'toolbar',
    '#access' => \Drupal::currentUser()->hasPermission('access toolbar'),
    /*
    '#cache' => [
      'keys' => ['toolbar'],
      'contexts' => ['user.permissions'],
    ],
    */
  );
}

Can I overrule the toolbar cache by using the #cache array in my custom toolbar items? Which tags/context should I use?

This is how the toolbar looks like with my compact_toolbar module enabled... (but toolbar cache disabled) I really like the result! - I also made the menu behave like a simple dropdown menu and added a "content menu" to quickly add new content...


texts: jQuery dialog is duplicated when set on a form that uses AJAX

texts:
Im using jQuery dialog on my form.

Drupal.behaviors.custom = {
attach: function (context, settings) {

    $('.form-container').once('form-cont', function () {
      Drupal.custom.modalLinks();
    });

    $('.my-form').once('my-form', function () {
       Drupal.custom.setModal(this);
    });

);

  Drupal.custom.modalLinks = function () {
    $('body').on('click', '.modal-link', function (e) {
      var id = $(this).data('modal-id');
      var className = $(this).data('modal-class');
      var $modal = $('.modal--' + id);

      $modal.dialog('widget').
        addClass('modal__wrap--' + className).
        addClass('modal__wrap');
      $modal.dialog('open');

      e.preventDefault();
    });
  };

Drupal.custom.setModal = function (container) {

    var $container = $(container);

    $container.find('.my-modal').
      dialog({
        autoOpen: false,
        draggable: false,
        width: 900,
        minHeight: 120,
        modal: true
    });

};

This is working fine when the page is first loaded. However my form has AJAX submission. When submitted the form then returns a new form which also has a dialog modal link.

If I submit the form then when it reloads with AJAX then the jQuery dialog modal is duplicated (not visible but I can see with dev tools). If I open the dialog now then 2 modals are opened.

From reading about duplicate dialogs (but not for Drupal specifically) it seems the solution is to use remove or destroy on the modal. However when I try this is always completely disables the modal, it doesn't just remove the duplicates.
https://stackoverflow.com/questions/2864740/jquery-how-to-completely-remove-a-dialog-on-close


texts: Pager will come by default in blogs template or not?

texts: I am using blogs  module in one of the website. I have created a template file for that, I want to add pager if blog items exceeds that 10. So my question is in that template file how can I use pager. It will display by default or is there any other ways to add pager to that template.


texts: Picking image from server: FileField_Sources not working

texts:
I currently have some nodes that use images.
Problem is: every time I want to choose an image, I have to upload it again.
It would be much better if I could just use a path picker, which could show which images are already uploaded.

This way I could upload the images through FTP and would make me able to give the authors only the rights to choose an already existing image, to be safe with author rights of the pictures.

I found that FileField_Sources can give the file picker, yet still have the upload function as well, ok fair enough, it's just a matter of telling the authors not to use the upload function.

Problem is, it doesn't work.

I installed the following modules:

FileField Sources
IMCE
IMCE for FileField

However, my original file upload is still unchanged

And I also don't have any new options to choose from in my content types manage fields part.

PS: Yes I activated all the modules in the modules page.

PS2: I also tried to use imagepicker as a module, but this adds a picture in the body. This is NOT what I want, I need the image to come into an image field.

A secondary question as well:
I want to put the copyights of the pictures on the site as well: preferably a bar coming over the bottom of the picture when you hover it, but a text below is also good enough.
If anyone knows a module for this or anything like that, it would very much be appreciated. If not I will just add an extra text field "copyrights" that I will just show below the pictures.


texts: How to list nodes that share only the first selected value in an entity reference field?

texts:
I have entity reference field to a taxonomy vocabulary on a node, which is a multi value field.

In Views, how do I list related nodes that share only the first selected category?

Example: Suppose I have selected "category3" and "category4" for a node. I want to show other nodes which have selected "category3".


texts: How to count the number of values in a multi value field with the Paragraphs module?

texts:
I’m currently using the Paragraphs module. I have pretty much set up a simple bundle with a title, image and text area. I went into the basic page content type and added the paragraph field reference which worked fine. This had a limit of up to 6 paragraphs per basic page. They can add less than 6, just not any more than 6.

My question is, how do I count how many paragraphs have been entered on that particular basic page. I’m trying to count the amount of paragraphs added so each time it’s added it can dynamically modify the class containing the paragraph.

For example, using Foundation 5 I want to count how many entries have been made and if there is 3 paragraphs then I want the name of the class to be foo for example.


texts: Can you make a block appear only in a specific content-type

texts:
The natural option is to filter blocks by node ID's. I am looking for a way to filter it by content-types (i.e the block "roses in special prices!" will appear only at the content type "Flowers").

Google search didn't help me very much in this subject. Thank you for your help.


texts: Print whole expanded Main Menu in page.tpl.php / menu block

texts:
I am looking for a way to use drupal_render() to show the entire expanded main menu.
Right now I am using this piece of code, but since I use the Menu blocks module from the third level on, all links from level 3 (and down) are missing here. Solution must be working with i18n, too.

if (module_exists('i18n_menu')) {
  $main_menu_tree = i18n_menu_translated_tree(variable_get('menu_main_links_source', 'main-menu'));
}
else {
  $main_menu_tree = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
}
print drupal_render($main_menu_tree);

Any idea on how I can get all links shown?


texts:
I want to display a block on the user/* page. I checked "only the listed pages" and entered "user/" but the block also appears on "user//relationships" for example.

How can I keep the block on just the first path?


texts: How to check whether a username already exists?

texts:
I had created a controller where I can create a new user programmitically by the following code.

$user = User::create();

      //Mandatory settings
      $user->setPassword($password);
      $user->enforceIsNew();
      $user->setEmail($email);

      //This username must be unique and accept only a-Z,0-9, - _ @ .
      $user->setUsername($username);

      //Optional settings
      $language = 'en';
      $user->set("init", 'email');
      $user->set("langcode", $language);
      $user->set("preferred_langcode", $language);
      $user->set("preferred_admin_langcode", $language);
      $user->activate();

      //Save user
      $user->save();
      drupal_set_message("User with uid " . $user->id() . " saved!\n");

      $uid = $user->id();

I am passing all variables via postman by POST method. I am using email as the username. But I want to check a condition (whether the username is already exist ) before the user creation. How can I write the if condition?


texts: Issues with custom redirect url using tokens when form field is empty

texts:
I am trying to use Drupal webforms with tokens to build out a redirect url for my form submissions. Everything works great when all fields are populated, but if a field is left empty the redirect does not happen. Promo code is an optional field. This is with Webform 6.x-3.14

Redirect URL: %value[app_url]/user/new?email=%value[email_address]&first_name=%value[first_name]&last_name=%value[last_name]&promo_code=%value[promo_code]


texts: How do I spawn additional instances with the same configuration?

texts:
I have the following scenario:
I will develop an application based on Drupal.
Everything will be developed on a local instance.
Composer files, configuration and so on will be kept in a git repository.
The repository will be hosted on GitLab.
I will use the CI/CD features over there.
I will need one test instance.
The project starts with one production instance.
In the future, there will be additional production instances.
They all should have exactly the same configuration, but different content.
I already did something like this, where I copied the initial database from my local install to my test and production server.
Afterwards, my CI/CD scripts could load the configuration from git to the different instances.
But there, I only hat one production server.
If I remember correctly, configuration is bound to an ID of the initial database.
So, I can't just set up a new instance and load the configuration from the old one.
Since they all will have exactly the same configuration, I would love to have a develop branch for delivering to the test server and a master branch to deliver to all production servers. If there are better solutions, I'm also open for them.
What would be the best workflow to add additional instances in the future that use the same config and can receive updates from the same CI/CD?
Would this workflow be completely incompatible in the case that, somewhere in the future, one instance would start getting additional configuration?


texts: How to validate dependent fields for a content type?

texts:
In one of my content types I have 1 field 'venue' with a drop down option. If I select 'venue' as 'other' from the drop down, some other fields (say 'venue address' and 'venue name') should become required fields and the node should not be saved or updated if those required fields are empty.

This is the screenshot of the rule I created.

This is my rule in Rules export format:

{ "rules_schedule_program_venue" : {
    "LABEL" : "Schedule Program venue",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_presave--schedule_programs" : { "bundle" : "schedule_programs" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_venue" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_venue_address" } },
      { "data_is" : {
          "data" : [ "node:field-venue" ],
          "op" : "IN",
          "value" : { "value" : { "9" : "9" } }
        }
      },
      { "data_is_empty" : { "data" : [ "node:field-venue-address" ] } },
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "schedule_programs" : "schedule_programs" } }
        }
      }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "address field is required",
          "type" : "error",
          "repeat" : "0"
        }
      }
    ]
  }
}

Please let me know what Rules Action I need to add to show an error message without updating or saving node.

I tried adding the Show a message on site action, but it is updating or saving the node anyway. I also tried with the Set an error on the form action, but in Data selector there isn't the field venue address.

Any other suggestion using javascript or jquery  to achieve this task is also fine.
Can anybody help me in using 'Rules Forms' module in this case?


texts: Add a custom form only to a particular content type

texts: is there any way to add a form only to a particular content type so that in all nodes of my content type, say, My_Custom_Content, that form is displayed but not on any other nodes


texts: Why is my MONTH view still showing a DAY as the title?

texts:
UPDATE: I see the issue was not fixed in the current release so am especially interested in any suggestions for workarounds. For example, maybe I could hide the default header with CSS and add the correct title in the view.

ORIGINAL QUESTION: I know this was a bug in the 7.x-2.x-dev version of the Date module, but it seems to have been patched. I am running 7.x-2.8 (the latest) in which it should be fixed.

Why am I having this problem, and more importantly how can I work around it? I am working on a site where I only have access to the site administration, and not the server (ie: I can't patch the module myself).


texts: How can I use the Review Order Pane twice in Commerce Checkout?

texts:
I'd like to be able to use the Review Order pane twice in the Commerce Checkout... first before the customer enters payment and then again when they Confirm the order.

Or do I need to create a new Pane?

Is this possible? How?


texts: Error when creating taxonomy term programmatically

texts:
I'm trying to create a term programmatically:

$term = Term::create([
  'vid' => 'vocabulary_mane',
  'name' => 'term_name',
]);

$term->save();

I can see my term in my overview page in the back-end:

But when I click on modify, I will receive an error page:

In the journal this is the log:

What is wrong?


texts: Disabling module with config sync and removing with composer

texts:
I have an issue disabling modules, I've searched but cannot find something useful:
 - Developer A disable module and via composer remove it
 - I pull his changes so i run composer install that remove the code, then drush cim to update configuration, but it complains that the module is missing while it's trying to delete its configurations.

What's the right way to do this? I can't import config before running composer install because along the uninstalled module there could be also new modules needed for the configuration import.


texts:
I'm Drupal beginner and I can't figure out one small thing.

How can I use TinyMCE for comments ?

Please, see image below:

I have already defined some custom formats and WYSIWYG profiles, but can't figure out how to "attach" them;

Thanks.


texts: View listing related nodes by taxonomy term

texts:
I have a content type representing a book. Each book as a genre (SciFi, Fantasy, Thriller ...) and I would like to expose, on the page of a book some books sharing the same genre.

I created a view with a contextual filter on the taxonomy term, but I retrieved the current book so I added a contextual filter on tue current node id to exclude it.

Now I don't retrieve anything from my view.

Each contextual filter on his own his working. If I just use the contextual filter on the content id, I retrieve the list of my books without the current book. If I just use the contextual filter on the taxonomy term, I retrieve the list of my book for that genre (including my current book).

How am I supposed to proceed to have both filter working together ?


texts: How to avoid Exif data rotating images automatically after upload?

texts:
an image has been taken upside down, then rotated with any software, then uploaded to my Drupal website and it shows how it was originally taken because it read the Exif metadata.

Is there a way to avoid this?

or, if that's not possible,

how can I add a rotation Image Style drop down that the editor can select when creating the node?

Based on the picture preview, after uploading the picture, the editor would select an Image Style that would set the orientation of the picture right. if the picture is upside down, the editor could selec


texts: Menu Block won't display when a page has a View Block on it

texts:
I have Menu Block installed to provide some contextual menus for certain areas of a site. These generally work great. But I have a few pages where I'm adding a Views generated block to the bottom of the page, and on these pages the menu block seems to ignore the fact that these pages exist in the menu system and will not show anything.

If you have experienced this before and have a solution that's fantastic. Otherwise I'm hoping for some pointers as to where to look around for potential issues?

Update 1 - Seems to be related to the View block using the row style 'node', vs. using 'fields'. If I change it from node to fields, then menu_block works as expected, otherwise menu_block disappears.

Update 2 - Ended up just converting all offending Views elements to the field row style in order to continue on. So that worked around the problem, be curious if anyone else ever encounters the issue though.


texts: Drupal and reverse proxy: How to make Drupal aware that it's protocol is HTTPS?

texts:
I have a reverse proxy Docker container in front a Drupal container on a Docker host.
My reverse proxy container is https://hub.docker.com/r/jwilder/nginx-proxy
The public site URL is https://ahora-stage2.dcycleproject.org
When a request is made to https://ahora-stage2.dcycleproject.org, drupal receives the following headers. I ran dpm(\Drupal::request()->headers); using devel/php on a backend web interface:
stdClass Object ( [__CLASS__] => Symfony\Component\HttpFoundation\HeaderBag [headers:protected] => Array ( [authorization] => Array ( [0] => ) [host] => Array ( [0] => ahora-stage2.dcycleproject.org ) [connection] => Array ( [0] => close ) [x-real-ip] => Array ( [0] => 216.246.250.184 ) [x-forwarded-for] => Array ( [0] => 216.246.250.184 ) [x-forwarded-proto] => Array ( [0] => https ) [x-forwarded-ssl] => Array ( [0] => on ) [x-forwarded-port] => Array ( [0] => 443 ) [content-length] => Array ( [0] => 212 ) [accept] => Array ( [0] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 ) [content-type] => Array ( [0] => application/x-www-form-urlencoded ) [origin] => Array ( [0] => https://ahora-stage2.dcycleproject.org ) [accept-language] => Array ( [0] => en-ca                 ) [user-agent] => Array ( [0] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 ) [referer] => Array ( [0] => https://ahora-stage2.dcycleproject.org/devel/php ) [accept-encoding] => Array ( [0] => gzip, deflate, br ) [cookie] => Array ( [0] => SESS06c9cc57c2abbd62a4b35358c6967749=zmOe3Gexxxxxxxx7238990ldZb50rMxl35yPOeM ) [x-php-ob-level] => Array ( [0] => 0 ) ) [cacheControl:protected] => Array ( ) )

Based on that information, https://x-team.com/blog/base_url-drupal-8/, https://medium.com/@lmakarov/drupal-8-and-reverse-proxies-the-base-url-drama-c5553cbc9a3e, and comments in the settings.php file, I put these custom settings in my Drupal settings.php file:
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = ['104.236.70.29','216.246.250.184'];

Nonetheless, Drupal always keep believing that the protol is HTTP, not HTTPS.
See enclosed image.

I'm wondering how I could set it up so that Drupal understands that it's behind a reverse proxy and that it's public URL should be served using the https protocol.


texts:
I have created a custom form display mode my_mode for nodes and wish to display node form using this mode instead of default one at a custom page. How can I do it?

$this->entityFormBuilder()->getForm() accepts an operation as a parameter, but not form mode.


texts:
I'm fairly new to Drupal and I'm struggling to find where and how I should approach the problem I'm describing below. I suspect I will have to dive in the code but that's ok I'm comfortable with PHP.

I have a content type "Event" with a "Date & Time" field called "Event Start Date". I've configured the Date format to be "l, F d, Y - h:i a", but it's not exactly what I'm looking for.

I need to add a condition to my date format so that it doesn't display :00 when the minutes are at 00.

For example

Tuesday, January 25, 2017 - 9:15 am
Tuesday, January 25, 2017 - 9:00 am

should display

Tuesday, January 25, 2017 - 9:15 am
Tuesday, January 25, 2017 - 9 am

How and where should I be doing this in code?

Preferably, I would like to be able to tell when to apply this rule.


texts: How to use Drupal 8 ajax API for Menu links

texts:
I have a taxonomy menu on the left side of the screen. When I select a menu item I want the results to appear in the main content area of the screen.

I want this to happen using AJAX. I have been reading the AJAX API documentation from Drupal:
https://api.drupal.org/api/drupal/core%21core.api.php/group/ajax/8.4.x

It says I can add a "use-ajax" class to the link, which I have. But then there is no documentation regarding how to get the link to load in a target ID.


texts: Hook into Web-Form POST to send another POST request to 3rd Party Server?

texts:
The site I am working on has multiple Contact us type forms that are using a web-form plugin. They have a contact form that is on every page, 1 to 2 times per page. This contact form saves to the back-end and database when submitted.

Below is the basic form without the form elements.

<form action="/" accept-charset="UTF-8" method="post" id="webform-client-form-9" class="webform-client-form" enctype="multipart/form-data" _lpchecked="1">
  <input type="hidden" name="Provider" value="YourLeadSource">
  <input type="hidden" name="Client" value="L360">
  Fname: <input type="text"  name="fname" value="John"><br />
</form>

Now I have been tasked with keeping the current functionality, posting and saving to the database, but also adding new functionality to make it also POST or GET the same form submission to a third party site called leads360.

I need to have it also send a POST or GET request with the form data to https://secure.leads360.com/Import.aspx?Provider=TeledirectBusinessName&Client=CompanyName&CampaignId=12345.

In theory this should be really easy, if I can hook into the system and send a POST or even a GET request to that URL which will then post data into the third-party system.

The problem is my limited knowledge of Drupal. I know its plugin/hook system is nothing like WordPress or Magento.

Would you use some sort of hook in the backend, or intercept the post with JavaScript the way the Stripe API does for payments?


texts: Strange symptoms after Drupal 8 core update

texts:
I'm new to Drupal 8.

After updating D8 Core to 8.3.2 when I try to access Block Configuration Page, I get this error:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.block.disable" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Moreover, a new entered view path gives "page not found".


texts:
I have a homepage view called FrontPage. Currently, it shows the pagination link like "1, 2, 3 Next->" as it should; when I click on Next, it goes to http://example.com, not http://example.com/page/1/0.

I have checked the taxonomy archive, and it is has the same problem. The same is true for the Blog posts.

I checked pager.inc, but I don't see any problem. I haven't hooked anything in template.php.

Why is the Next link pointing to the wrong page, and what could I do to fix it?


texts: How to assign a specific color to each taxonomy term in a chart created with the Charts module?

texts:
I have a view with format "Chart" and I'm using Highcharts as my charting library.

In the settings there is a section to choose the colors of the chart.

My content has a field that can have 3 different values. On the chart, the colors are assigned randomly for that field.

Is it possible, using the Charts module, or in any other way, to assign a specific color for each of the field values (the field is a taxonomy term)?


texts: Bootstrap and require a method from a separate module

texts:
I have a script that runs outside of my module, which bootstraps Drupal.

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
use Drupal\smart_ip\SmartIp;

chdir('../..');

$autoloader = require_once 'autoload.php';

$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();

$ip = $request->getClientIP();

$location = SmartIp::query($ip);

My problem is that using the Smart IP query method (SmartIp::query($ip)) throws an error:

TypeError: Argument 1 passed to Drupal\Core\Session\SessionConfiguration::getOptions() must be an instance of Symfony\Component\HttpFoundation\Request, null given, called in /var/www/drupalvm/sitelog/core/lib/Drupal/Core/Session/SessionManager.php on line 111 in Drupal\Core\Session\SessionConfiguration->getOptions() (line 40 of /var/www/drupalvm/sitelog/core/lib/Drupal/Core/Session/SessionConfiguration.php)
#0 /var/www/drupalvm/sitelog/core/lib/Drupal/Core/Session/SessionManager.php(111): Drupal\Core\Session\SessionConfiguration->getOptions(NULL)
#1 /var/www/drupalvm/sitelog/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php(278): Drupal\Core\Session\SessionManager->start()
#2 /var/www/drupalvm/sitelog/vendor/symfony/http-foundation/Session/Session.php(87): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('attributes')
#3 /var/www/drupalvm/sitelog/modules/smart_ip/src/SmartIp.php(100): Symfony\Component\HttpFoundation\Session\Session->get('smart_ip')
#4 /var/www/drupalvm/sitelog/modules/smart_ip/src/SmartIpLocation.php(167): Drupal\smart_ip\SmartIp::getSession('smart_ip')
#5 /var/www/drupalvm/sitelog/modules/smart_ip/src/SmartIpLocation.php(133): Drupal\smart_ip\SmartIpLocation->getData(false)
#6 /var/www/drupalvm/sitelog/core/lib/Drupal/Component/DependencyInjection/Container.php(264): Drupal\smart_ip\SmartIpLocation->__construct()
#7 /var/www/drupalvm/sitelog/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'smart_ip.smart_...')
#8 /var/www/drupalvm/sitelog/core/lib/Drupal/Component/DependencyInjection/Container.php(494): Drupal\Component\DependencyInjection\Container->get('smart_ip.smart_...', 1)
#9 /var/www/drupalvm/sitelog/core/lib/Drupal/Component/DependencyInjection/Container.php(236): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#10 /var/www/drupalvm/sitelog/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'smart_ip.get_lo...')
#11 /var/www/drupalvm/sitelog/core/lib/Drupal.php(158): Drupal\Component\DependencyInjection\Container->get('smart_ip.get_lo...')
#12 /var/www/drupalvm/sitelog/modules/smart_ip/src/SmartIp.php(36): Drupal::service('smart_ip.get_lo...')
#13 /var/www/drupalvm/sitelog/modules/sitelog/sitelog.php(23): Drupal\smart_ip\SmartIp::query('192.168.88.1')
#14 {main}.

I hoped that by putting use Drupal\smart_ip\SmartIp;, at the top of my script, I would have access to the module's methods, but I don't.

I don't understand what is required to make the Smart IP query function available to my script?


texts: Better way of adding Image as Block in home page

texts:
I am designing a personal website. I wanted to display my photo in the side bar in the home page. Below is screenshot-

To get the above display, I have created a basic page in which I have inserted the dummy image using IMCE in CKEditor. Then I have created a view, which is a block of basic page. In this view, the filter criteria is the content title, which should be equal to "my passport size image". Now I have added this block to sidebar.

I am looking for a better way to achieve the same.


texts: My server does not allow passwords and requires me to setup an openssl key for access. Drush however requires the server to be more open and I wonder how to setup an openssl key or some other option for using drush update features.


texts: Using Git to keep Core and modules up to date

texts:
I'm looking for a way to use git to pull both core and modules. Let's say for example that I clone Drupal core from the Drupal git, and commit to my own git repo; then, I pull a bunch of modules, and also commit to my own git repo.

Is this even possible? Can I have sub folders within a repository that are checked out from a different repository? Can I still use Drupal to keep my code up to date? Perhaps I'm not really understand some git fundamentals.


texts: Where is the value in a form textfield stored?

texts:
I have created a simple form that displays a textfield and a submit button. The text field is defined:

$form['upload_file'] = array(
    '#type' => 'textfield',
    '#title' => t('File to read')
  );

When I enter "test" in the textfield and select the submit button, the form moves on to the Validate function which has the following code:

$answer = $form_state['values']['upload_file'];
  if (!$answer) {
    form_set_error('upload_file', "Please enter a file name: ");
  }

And I get the error message indicting that $answer is empty. Do I have the wrong array location for the stored textfield text? Or is there something else I need to do to place the values in the form ito the values array?


texts: Drupal and security hardening - PHP chmod

texts:
I am struggling with the following case with Drupal and PHP hardening on an Red Hat Linux infrastructure.

For drupal installation a user has been created. All the files and directories are owned by this specific user. Due to the security hardening that we have applied, we restricted chmod from PHP and now drupal is not working properly. In order for new content to be uploaded to site from the Administrative panel, chmod is being used so that files should be uploaded under /sites/default/files with the proper rights.

Also I have problem when updating the Drupal CMS as .css files are also not uploaded with the correct permissions. 600 instead of 644.

Could I somehow make drupal work correctly with restricting chmod?

Is chmod a requirement in order for Drupal to work?

I have included apache user in the user (the owner of drupal files) group but still cannot make it work with restricted chmod. If I remove chmod restriction then Drupal works properly.

Chmod is restricted through disable_functions of php.ini

Can you advise?


texts: Why do images rendered with image_style_url disappear on iPhone?

texts:
I use "image_style_url" to render images in node template. Everything works fine on web browsers. However, these images disappear on iPhone.

Here is my code:

        <?php
            foreach($node->field_project_pics[LANGUAGE_NONE] as $project_pics){
        ?>
                <img class="carousel-item" src="<?php print image_style_url('eve_project_page_detail__700x476_', $project_pics['uri']);?>" alt="">
        <?php
            }
        ?>

Link: http://tvphong.x10host.com/node/62

Any suggestions?


texts: Menu Link not translating correctly on initial creation through node form

texts:
Using Entity Translation and Entity Translation Menu

On the node form, there is a section called "Menu Settings" then "Provide a menu link".

1) Create a new node, click "Provide a menu link" and put in your English menu item title.
2) Translate the node, click "Provide a menu link" and put in your French menu item title.
3) The menu item displays the french menu item title no matter which language you are viewing the site in.

The menu item's title that you created during the English version is overridden with the French menu item title. In fact, when you edit the menu item through the /admin/structure/menu interface, there is only one translation, the default. All we did was
override the default translation with the french translation.

After a while I figured out how to get around this.

1) Create a new node, click "Provide a menu link" and put in your English Title.
2) Go to /admin/structure/menu/manage/main-menu, move your new menu item up or down, and click "Save Configuration". This properly sets the properties of the menu item.
3) Translate the node, click "Provide a menu link" and put in your French Title.
4) It works!

But obviously, we can't have our administrators jumping through the extra hoop. If someone can tell me if there is already a fix on this issue or if there is a hack I can do which re-saves the menu-item after it's created, please let me know


texts:
I have over a dozen languages on my site and we use Json:Api since it's a decoupled drupal.
Problem is that I can't figure out how to get the translated node values from the Json:Api response.
The Json:api url is as follows:
https://mysite.com/jsonapi/node/{bundle}/{uuid}?include=field_image,field_taxanomy

And it returns all the data with the relationships for the two extra fields included, but how do I request the data for a translation??? (almost each node has been translated into each of the available languages)


texts: How to restrict access to a node via node/12 and allow access via a path like content/sometitle?

texts:
Problem: I want to restrict direct node access using node number www.example.com/node/12 and allow access using pathauto alias www.example.com/content/sometitle to anonymous user. This user should be allowed to see all content of node using only Pathauto title path but not with node number to snoof.

Mostly I want to target anonymous users. Admin always has access to everything.

In simple terms, I want to redirect all node/Number paths (not node/add/ContentType) to say the Home page or No Access page.


texts: How to change the machine name of the content type in Drupal 7

texts:
I found an annoying typo in the machine name of one of the content types, and I'd like to fix it. The only way I know is to delete the content type, and create a fresh one, but there is a plenty of fields in that content type that I don't want to recreate.

Is there a better way?


texts:
My pathauto patterns are giving me trouble with organic groups. All books are contained within groups.

Book_main_page shows as:

  Group_name/Book_main_page

A child of Book_main_page shows as:

  Group_name/Group_name/Book_main_page/Child

A child of the child page shows as:

  Group_name/Group_name/Group_name/Book_main_page/Child/Child_of_child

How do I get rid of the repeated group names?

The group content type "book page" has a "Pattern for all Book page paths" of:

  [node:og-group-ref]/[node:book:parent:url:path]/[node:book:title]

The group type "Group" has a "Pattern for all Group Paths" of:

  [node:og-group-ref]/[node:title]

My page uses one group content type "book page" (from the books module) and one group type "group".


texts: On Feed API, what does the setting "Delete news items older than:" mean?

texts:
Using FeedAPI on a site I just started working on (but getting ready to get rid of it), and I don't understand this setting:

"Delete news items older than:"

Does that mean "delete unpublished items after a set time"? Or "delete published items we've turned into posts after a set time"? Or just "ignore items coming in from a given feed if they're older than this?"

Or something else altogether?


texts: non-existant URL containing a valid parent path returns 200, not 404

texts:
For example, if you add extra parameters to node urls (node/[nid]/extra/s if you go to https://www.drupal.org/node/2536034/test/any/thing/in/here/should/404
it renders the page beacuse the node exists but it should be a 404.
I was able to change that in a menu alter hook inspired by at https://www.drupal.org/node/432384

/**
 * Implement hook_get_item_alter().
 *
 * Return a 404 for non-existing paths instead or rendering parent path.
 *
 * @see https://www.drupal.org/node/432384
 */
function mymodule_menu_get_item_alter(&$router_item, $path, $original_map) {
  $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
  $ancestors = menu_get_ancestors($parts);
  // Avoid adding ancestors on admin paths because it breaks views admin ui.
  if ($original_map[0] != 'admin') {
    // Add wildcards to "ancestors" that don't have enough parts.
    foreach ($ancestors as &$ancestor) {
      while (substr_count($ancestor, '/') + 1 < count($parts)) {
        $ancestor .= '/%';
      }
    }
    $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
  }

but this definitely breaks anything that does not completley utilize the menu system. For example, views urls
admin/structure/views/view/someview/edit/panel_pane_1

Is there an appropriate way to tackle this?


texts: How can I redirect users on login with PHP?

texts:
I'm trying to redirect users with certain roles to different pages on login.  Sample code is below:

function MYMODULE_user_login(&$edit, $account) {
  // Allow users to reset their passwords
  if (!isset($_POST['form_id']) || $_POST['form_id'] != 'user_pass_reset') {
    // Admin
    if (in_array('administrator', $account->roles)) {
      $redirect = 'admin/hud';
    }
    $edit['redirect'] = $redirect;
    dpm($edit);
    dpm($redirect);
  }
}

This is based on drupal.org login hook documentation about "How to redirect users after login in drupal?" and the answer to "Custom redirect on custom page for admin user".

The problem is that when I actually log in with a user having the given role, I am redirected to /user, not my custom path.  The results for dpm() for $redirect and $edit->redirect show the path specified in my code, so why am I not getting redirected there?

I had this working in Rules, where there is a Force redirect checkbox.  But I am trying to move the code out of rules because it relies on a lot of custom PHP to check various conditions.


texts:
I'm using Drupal 8.6.9 and have four languages setup:

English (Default)
Spanish
German
French

When I create a node of any content type and publish it as each one of these languages, everything seems fine when logged in. When I log out and view these pages they're fine again, but only for the default language. If I try to view a translated version of a node I just get redirected to the site's root back on the default translation.

I'm using URL detection which works when logged in fine.

There are no custom permissions setup and everything is properly published.

I can see that the redirect is a 308 Permanent Redirect from looking at the dev tools.

I've tried rebuilding permissions, clearing the cache etc with no success, any help would be much appreciated!

Thanks


texts: Sub-theme adding prefix to all block machine names

texts:
On my site, I have created a sub-theme of a sub-theme using this as a guide to set this up https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme and it does work with carrying over all of the css/js/regions but for some reason, it is renaming all of the blocks with the prefix of the sub-theme.

So, for example, I have a block with a machine name of mainnavigation when I install/set as default the sub-theme it will change this block to theme3_mainnavigation.

I have tried removing the block and placing it back in with the same name of mainnavigation but I run into an issue where a message will appear that says this machine name already exists.

Does anyone know how to get around this so the sub-theme will use the machine names of already existing names instead of creating a prefix?

Thanks for any help!


texts: How can I Export Calendar from Drupal site A to Drupal site B?

texts: I have a new Drupal 7 site without Calendar events. How can I export my old Drupal 7's calendar events into this new Drupal site?


texts: How to add a custom row class or ID to type table render elements

texts:
I'm trying to add row ID's for a custom table I implemented via a custom module. But when I append an ID to the '#attributes' array it becomes the table ID, not the row ID. How can I define IDs for rows?

This is what I have so far:

$form['table'] = [
  '#type' => 'table',
  '#header' => $header_table,
  '#rows' => $rows,
  '#attributes'=> ['id' => 'IdforRow'],
  '#empty' => t('No Data found'),
  '#prefix' => 'Total Tenders : '.@$count.'
',
  '#suffix' => '',
];


texts: programmatically getting custom node belonging to a term

texts:
have searched google but cannot find anything specific . Intention is to get all Custom Node types that have been assigned a specific term of vocabulary . for example the follwoing is a db query to get custom node type.

$query->condition('type', "news_article")->fields('n',array('nid'))->orderBy('created', 'DESC')->range(0,90);

can the same query be modified to also add the  filter for term id .

One other related question is that how can (in PHP) we get the term id from the url of the pattern e.g <drupal site>/taxonomy/term/2 .

any help appreciated


texts:
Is it possible to override views-view-fields.tpl.php file for a specific view?  I've tried creating a views-view-fields--view-name.tpl.php file and have re-scanned template files and cleared the cache with no effect.  Similar issue as reported here: http://drupal.org/node/1137942

Though if I name the file views-view-fields.tpl.php in my theme folder, the new file is applied when template files are re-scanned. But this would mean that it applies to all views.

I noticed that views-view-fields.tpl.php is NOT one of the files listed in the Theme Information screen which Views presents.

Can someone definitively tell me that overriding of this file by creating a views-view-fields--view-name.tpl.php (or following similar naming conventions) is not possible/is not supported?


texts:
Hello im sure that this would be possible from my experience of drupal. I have threaded comments. People who reply to comments up the thread have their comment up next to the comment they replied to. My members seem to miss these comments when viewing the thread. Is it possible to add a css class or something so as unread comments are a differant colour?

Thanks


texts: Assign Users to next state in workbench module

texts:
Is there a way around to send a node in next state defined by work bench module to specific user instead of user role.

There is a similar question asked already for which one of the answers says using workbench access module can help, but I am not seeing a way to assign a content to a specific user using workbench access module.

My understanding with workbench access module is we can check access for a content to be accessible with what users, but not to choose any specific user while on the content. I mean to say we can put a check on content access on basis of taxonomy or menu which is supposed to be configured with what users can access it, so its more of hard coding the options and not allowing the user to choose on the fly.


texts:
What I need is a way to search with solr in drupal for everything that DOES NOT contain the given keywords.  The default exclusion seems to require a base search first (ie at least one word to search for) however there doesn't seem to be a wildcard that will pull up just everything so I haven't been able to work out this issue.

I have tried filters but the same problem exists that I need to search for something before I can exclude anything, which in my case means I need to search for everything so that I can exclude a few things.

Any help here would be great, this is driving me crazy.


texts: Migrating revisions from external data source

texts:
We are trying to migrate content from an external data source into Drupal 8 using the core migrate modules.  This is a stripped down example of the data being migrated:
id     resourceId     articleId     version     title          body
---------------------------------------------------------------------------
1      10             10            1           Page title     Page content
2      10             10            1.1         Page title     Page content
3      10             10            1.2         Page title     Page content
4      11             11            1           Page title     Page content
5      11             11            1.1         Page title     Page content

The id field is the unique identifier, and is the field set in the getIds() method, when as you can see the resourceId and articleId are more a preferred representation for a node id to be migrated into Drupal.
From my understanding, after reading through the migrate_example modules, the query() method must only return a single row; so when our migration runs, all these records are migrated as new nodes when in the previous database they were just revisions of one piece of content.
If we are intended to only return a single row in the query() method, what is the best way to only migrate the most recent version of each piece of content?
My first attempt was to try and achieve this in the processRow() method, but then if the migration is going through the table row by row, then how can you remove/update a previous row if the next row is a more recent version?
We have an option to just run our own script on the table first, to filter out all most recent versions and then run the migrate script on that, but I would like to know if there is a way to achieve this using the core modules in Drupal.
Thanks in advance.


texts:
I have a website with 4 views (and sometimes 5 views) on the homepage. The problem is that when I try to open the website, it takes minutes to load and the cpu goes crazy because of mysql processes.

Screenshot of cpu usage

Output of SHOW PROCESS LIST

I work on a dedicated server with 8GB of RAM, 1900Mhz Intel Hexa-Core Xeon and 4 × 300GB SAS (RAID 10)

I have been using drupal for years, and never encountered such an issue. Any ideas how to fix this?

Update Views query:

SELECT DISTINCT node.title AS node_title, node.nid AS nid, node.language AS node_language, node.created AS node_created, users_node.picture AS users_node_picture, users_node.uid AS users_node_uid, users_node.name AS users_node_name, users_node.mail AS users_node_mail, taxonomy_term_data_node.tid AS taxonomy_term_data_node_tid, taxonomy_term_data_taxonomy_term_hierarchy.tid AS taxonomy_term_data_taxonomy_term_hierarchy_tid, 'node' AS field_data_field_news_photo_node_entity_type, 'node' AS field_data_field_op_section_term_node_entity_type, 'node' AS field_data_body_node_entity_type, 'user' AS field_data_field_user_realname_user_entity_type, 'user' AS field_data_field_user_organization_user_entity_type, 'user' AS field_data_field_profile_picture_user_entity_type
FROM
{node} node
LEFT JOIN {users} users_node ON node.uid = users_node.uid
LEFT JOIN (SELECT td.*, tn.nid AS nid
FROM
{taxonomy_term_data} td
LEFT JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
LEFT JOIN {taxonomy_index} tn ON tn.tid = td.tid
WHERE  (tv.machine_name IN  ('sections')) ) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid
LEFT JOIN {taxonomy_term_hierarchy} taxonomy_term_data_node__taxonomy_term_hierarchy ON taxonomy_term_data_node.tid = taxonomy_term_data_node__taxonomy_term_hierarchy.tid
LEFT JOIN {taxonomy_term_data} taxonomy_term_data_taxonomy_term_hierarchy ON taxonomy_term_data_node__taxonomy_term_hierarchy.parent = taxonomy_term_data_taxonomy_term_hierarchy.tid
LEFT JOIN {field_data_field_news_photo} field_data_field_news_photo ON node.nid = field_data_field_news_photo.entity_id AND (field_data_field_news_photo.entity_type = 'node' AND field_data_field_news_photo.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('news')) AND (field_data_field_news_photo.field_news_photo_fid IS NOT NULL ) AND (node.language IN  ('***CURRENT_LANGUAGE***')) ))
ORDER BY node_created DESC
LIMIT 12 OFFSET 0

EXPLAIN output.


texts: Moving drush installed directory to production site?

texts:
I am installing Open Social on Drupal 8 on my own Ubuntu Linux instance with Nginx, MySQL and PHP 7. Got the "Quick install" instructions using composer and drush completed successfully.

As a relative n00b to Drupal, there is a small gap in the documentation. You can complete an installation on a server using drush and you get a "site built" message - with everything in a directory in my user account. I'm looking at that, and looking at /var/www/html (which is where my public facing web server successfully serves traffic) and I think - eh - what now? The documentation does an exit stage left right there.

Same in the standard Drupal docs. The main clue is where you get vectored off to the procedure to create a dev site from a running production one (ie: the wrong way around). Which sort of suggests that you put the whole tree in the /var/www/html directory into an html/ subdirectory, but then hand edit settings.php to match the database credentials on your newly restored db backup.

So, to get the site running internet facing, is it as simple as moving the whole tree in my local directory under html/ to /var/www/html recursively, and then dragging a settings.php file up to the top level from ./sites/default/settings.php, then editing in the database credentials?

If I do move the website wholesale, nginx just http 500's the web site. Just working through some of the directory assumptions that composer uses... getting autoload.php failing to find a file at line 17.


texts: How to hide rating field when adding comment to own node?

texts:
On my website, users can rate nodes with the Fivestar module while adding a comment. In other words, the rating field (called 'stars') is part of the comment. Now, I'd like to hide the rating field for users when they comment on their own nodes (or when they already have commented before - see: How to hide Fivestar rating field after first comment?).

How can I do that?

Edit 1: I applied this patch (patch 97 on https://drupal.org/node/189527), but my problem still isn't solved. I now have the following option at Administration > Structure > Content types > MyArticle > Comment fields:

But after clearing caches and creating new content, the rating field is still displayed when I add a new comment.

Edit 2: I sent an e-mail to the patch's author and he answered this:

  The purpose of the patch I created is to prevent a user from rating
  their own node.  I believe the problem you are having with this patch
  is that, since the fivestar field is on the comment, that the patch I
  wrote would probably reference the comment itself (as the entity id)
  instead of the node - freely allowing someone to vote.

Edit 3: I tried to solve my problem with a custom module called 'hiderating'. This is the code I'm using:

function hiderating_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  if ($form_id == "comment_node_stuff_form") {
   if ($form['#node']->uid == $user->uid) {
      $form['field_stars']['#access'] = 0;
      }
      else {
      $form['field_stars']['#required'] = 1;
      }
    }
}

I made the 'Stars' field not required from the interface. The code is nearly working: the 'Stars' field isn't displayed when one comments on his/her own node, but unfortunately, it isn't turned to 'Required' when one comments on someone else's node. In other words, my code's else part doesn't work properly.

How can this be fixed?


texts: Migrate: Duplicate entries in url_alias after update migrations

texts:
I have term and node migrations from wprdpress to drupal 8 (with pathauto module enabled). I set the url alias in the migration templates like:

process:
  path/alias: source_path
  path/pathauto:
    plugin: default_value
    default_value: 0

Setting the path that way works fine on importing content with drush mi term. But when I update the terms with drush mi term --update a new (the same) path gets inserted into the url_alias table. For example the term with tid 1 gets imported once and updated 2 times there will be the following aliases in url_alias table:

select * from url_alias where source = '/taxonomy/term/1';
+------+------------------+---------------+----------+
| pid  | source           | alias         | langcode |
+------+------------------+---------------+----------+
| 1514 | /taxonomy/term/1 | /term-1-alias | de       |
| 2731 | /taxonomy/term/1 | /term-1-alias | de       |
| 3632 | /taxonomy/term/1 | /term-1-alias | de       |
+------+------------------+---------------+----------+

BTW: I have pathauto module enabled, but uninstalling it results in the same behavior.


texts: Modify instead of add a class in classes_array for theming purposes

texts:
I am using the following preprocess in my template.php

function paddle_admin_preprocess_menu_block_wrapper(&$variables) {
  if ($variables['delta'] === 'management_level_2') {
    $variables['classes_array'][] = 'max-width';
  }
}

It works as intended, it adds a class when the delta equals this string..

I am trying to modify another other entry of the classes_array array in order to make the classname more semantic. How would I go for that? (so replace an entry instead of add)

ps: I figured it can be as easy as:

$variables['classes_array'][1] = $variables['delta'];

but I am wondering whether the array indexes can change (from the ones I see with devel themer)


texts: Does running `drush rf` detect needed updates by look at the version of files on disk or by an entry in the database?

texts:
Does running drush rf detected needed updates by looking at the version of files on disk or by an entry in the database?

We run in a load balancer, fail over situations on a some production server. Databases are one-way replicated. If the primary is updated first (and database entries are replicated over), could an update be skipped on the secondary (backup) installation?


texts: Facets rendering on all pages irrespective of value dynamicaaly form contextual filter in views

texts:
I m trying to add facets using facets module in drupal 8. i have created listing of all products using views page. on listing page, facets are showing properly as per brand information added from admin panel.

All products listing Page:

but when i go to the detail page of every individual product,facet blcok show only single value of that brand only. check below image for more reference:

Here on detail page , i want to show complete list of facets as shown in first image. how to do that??? any idea??


texts:
When I try to uninstall a module using composer I get an error about the same module is missing, but the module exists. For example, if I run this command:
composer remove drupal/bamboo_twig

I get:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
  - Removing drupal/bamboo_twig (4.1.0)
Deleting web/modules/contrib/bamboo_twig - deleted
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Writing lock file
Generating autoload files
30 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

In PmCommands.php line 259:

  Unable to install modules bamboo_twig due to missing modules bamboo_twig.

pm:enable [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command> [<modules>]...

The module was installed previously.
I don't understand this weird warning.
I have tried with another module, and I have got the same issue.


texts: Form multiselect item and url encoding with GET method

texts:
I have a form on a Drupal 7 site, which is submitted using the GET method to refresh the page's display using the query parameters.
One of the parameters uses the select box, with the multiple option.  This results in the query parameter using the format option%5B%5D=39&option%5B%5D=54

Is there a way to have the form submit and merge the query parameters into something like option=39+54


texts:
I have a request for 1 user only ($user->name) that after they leave a particular node/page ($node->title) that they be automatically be logged off of drupal.  Leaving this page includes navigating to another page or closing the tab or browser window.
How could the automatic logoff when leaving a page for a particular user and node/page combination be accomplished?


texts:
How do I create a sub-theme using Drupal Console or Drush 9?

I looked at Creating a Drupal 8 sub-theme, or sub-theme of sub-theme and the documentation of drupal generate:theme, but I didn't find anything about creating a sub-theme from CLI.

My aim is to automatize the process with a CLI. Is it possible now?


texts:
In Drupal 8, despite the fact that there is a menu set for the content type, menu options are not showing in the node form.

I have disabled some menu modules in case they were interfering, but with no result.

What else can I check?


texts: I am using drupal 7 contact form in my site and I want to rename  some field names, like  "Subject" to "Emne" etc..


texts:
I need to calculate product sell price as gross price * markup (i.e. 1.4) Gross price is stored in field_data_commerce_price table (standard commerce price field). Markup value should be associated with every single product, so I can manage it with views using filters and VBO. I have many product types, so maually created markup field is not a good solution.

Is there any out-of-the-box solution?

and if not:

What is the best way to add new product field using API? (should be added by default for all product types)


texts: Not able to save the selected custom populated option list

texts:
I have a cck select list where the options are populated by my custom code. There is no issue for populating the list but after that the selected options are not able to save. Is there any way to fix this. Here is my code snippets:

function pelikan_common_form_alter(&$form, $form_state, $form_id) {
if ($form_id =='monitoring_node_form'){
    $nid = arg(3);
    $node = node_load($nid);
    $index=0;
      foreach ($node->field_test_monitoring['und'] as $key) {
       $show = node_load($key['nid']);
       $form['field_indicator']['und']['#options'][$index++]= $show->title;

     }
   }


texts: Restrict coupon for same shipping address (or user creating multiple email ids)

texts:
We have scheme “Register & Earn Coupon of Rs. 200”
Some users create multiple gmail accounts to avail multiple coupon.
They get the order shipped at the same place.
Is there a solution available to handle this?


texts: How can I AND two OR statements with the #states feature of Drupal 7?

texts:
This page explains nicely how to use OR with the #states feature. However, when I try to AND two OR statements, It doesn't seem to AND them together. Is there a way to do this? This is what I tried.

 'visible' => array(
    array(
      array(':input[name="vehicle"]' => array('value' => 'truck')),
      array(':input[name="vehicle"]' => array('value' => 'car')),
    ),
    array(
      array(':input[name="mileage"]' => array('value' => '10')),
      array(':input[name="mileage"]' => array('value' => '20')),
    ),

  ),


texts: How to better search: replacing %20 with +

texts:
When I search for "asus laptop type:product" the url is "search/node/asus%20laptop%20type%3Aproduct" but how to make it like "search/node/asus+laptop+type:product".
So how to repalce %20 with + and %3A with : on Drupal 7.
Thank you.


texts: Change markup shown before the search result

texts:
How do I change this markup from my .theme file?

Line 119 and following in core/modules/search/src/Controller/SearchController.php contain this code.

if (count($results)) {
  $build['search_results_title'] = array(
    '#markup' => '<h2>' . $this->t('Search results') . '</h2>',
  );
}

I want to remove the <h2> tags from my search page.

I am able to change the search form above, and the result list after that tag using
hook_preprocess_form()on the search form and hook_preprocess_search_result() on the search results.

Is there a preprocess function I am missing, or can I use a custom template?


texts: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'semaphore' doesn't exist

texts:
I am having problems migrating my site to a production server. It's build in Drupal 7. I used the backup and migrate plugin to export the DB. The development server is Windows with Wamp installed and the production server is CentOS with Cpanel.

These are the errors I am getting:

  Error The website encountered an unexpected error. Please try again
  later. Error message PDOException: SQLSTATE[42S02]: Base table or view
  not found: 1146 Table       'fosagams_co_za.semaphore' doesn't exist:
  SELECT expire, value FROM   {semaphore} WHERE name = :name; Array (
  [:name] => variable_init ) in    lock_may_be_available() (line 167 of
  /home/balabalab/public_html/includes/lock.inc). Uncaught exception
  thrown in shutdown function.

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table      'fosagams_co_za.semaphore' doesn't exist:
  DELETE FROM  {semaphore} WHERE (value = :db_condition_placeholder_0) ;
  Array (      [:db_condition_placeholder_0] =>
  191980980751f69eddeb26b7.24464293 ) in  lock_release_all() (line 269
  of /home/balabalab/public_html/includes/lock.inc).

I did however verify that the semaphore table exists. I am out of ideas, any help would be appreciated.

Thanks in advance.


texts: Why is my form submit button being rendered twice?

texts:
I have built a form and this is my submit button for it:

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => 'Name',
    '#theme' => 'custom_input'
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $this->t('Submit'),
    '#theme' => 'custom_input'
  );

  $form['#theme'] = 'custom_form_theme' ;

  return $form;
}

My custom_module.module file is:

function custom_module_theme($existing, $type, $theme, $path) {
  return array(
    'custom_form_theme'  => array(
      'render element' => 'form',

    'custom_input' => array(
      'render element' => 'form',
    ),
  );
}

I have a /themes/custom/form/input.html.twig file for inputs and also have a /modules/custom/custom_module/templates/custom_input.html.twig to theme the form I am creating. For now they are identical and I am using twig debug to see what template is rendering the elements. twig code below:

<input{{ attributes.addClass(text) }} />{{ children }}

The name textfield renders correctly and uses my custom modules templates custom_input.html.twig (which is what I want) however for the submit input, it gets rendered twice, firstly using my themes input.html.twig and then using my custom modules custom_input.html.twig so I get 2 button on my page. I dont understand why the submit is rendering twice.

What am I doing wrong?
Why does it render twice instead of overriding the /theme/custom twig?


texts: "Missing required paramter" with all Social Auth providers

texts:
The problem: I've just installed social_auth_google, social_auth_twitter and social_auth_linkedin modules. All the modules are configured (Client ID, Client Secret, and other similar fileds). The modules are installed through composer require ..., so I assume that all dependencies are there, but to confirm here's the list of the enabled modules:

  Social              Social API (social_api)         Enabled   8.x-2.0-beta4
  Social              Social Auth (social_auth)       Enabled   8.x-2.0-beta4
  Social              Social Auth Google              Enabled   8.x-2.0-beta3
                      (social_auth_google)
  Social              Social Auth LinkedIn            Enabled   8.x-2.0-beta1
                      (social_auth_linkedin)
  Social              Social Auth Twitter             Enabled   8.x-2.0-alpha2
                      (social_auth_twitter)

Besides these, composer also installed some non-Drupal packages to vendor directory:

  league/oauth2-client (2.3.0)
  league/oauth2-google (2.2.0)
  abraham/twitteroauth (0.9.2)
  league/oauth2-linkedin (2.1.0)

I've embedded "Social Auth Login" block to "Content" region of /user/login and /user/register pages, and I've got a decent-looking login/register pages as the result.

But the problem is that neither of the embedded authentication providers doesn't work. If I click g+, I get "Error: invalid_request. Missing required parameter: client_id". When I click twitter, I get: "You could not be authenticated, please contact the administrator.". With LinkedIn I get: "You need to pass the 'client_id' parameter".

Obviously I'm missing something... Any help?


texts: I have a view that takes fields and combines them or compares them and then gives me results in a new field (views conditional, global text etc..) but I need the TYPE of data that is returned. How can I figure this out? I do not have Drush on my current setup or we'd be good to go... I looked in the DOM and see nothing special about the field for example...


texts: Calculated field: How to calculate the sum of fieldvalues of all referencing entities

texts:
Using Drupal 7.43
Using ECK entities.

This question is based on my attempt to create a simple bookkeeping system in Drupal, in which I have Account entites and Expense entities.
The Expense entities reference an Account in an entity reference field.

The Account entity has a calculated field that should show the sum of the 'Price' fields in the referencing Expense entities.

I could accomplish this with Rules but prefer to keep reduce the administration of such complex rules.

Please assist in setting up the calculated field code for this purpose. Thank you.


texts: Which Rules Event should I use to change the value of a Select List field?

texts:
Use Case:

I've got two select lists

Due Date
Status

The Due Date is a Date field, the Status is a select list with options: Current, Past Due.

By default, Current is pre-selected.

I want to run a Rule that when the current date is greater than the Due Date, the value of the select list will change to Past Due.

I was trying to experiment with the Rules module, not sure about the event. Would it be Drupal is initializing?

What's the best approach?


texts: Hierarchy and taxonomies (like in the animal taxonomies)

texts: Trying to figure out how to implement hierarchical taxonomies. For example, take animals. Animals belong to a family, a genus and a species. family being the least specific, and species being the most specific. It's easy enough to create three taxonomy vocabularies, but in this case, a species belongs to a genus and a genus belongs to a family, there should be some way to infer the family and genus from the species. Please let me know if this makes sense, and there is a way to do this.


texts: Views alphabetical sorting problem for non-English language

texts:
I want to sort one of the views I created alphabetically but there is a problem (I'm sorting taxonomy terms by grouping them with the first letters):

The website's language is Turkish and in Turkish alphabet there is a letter between C and D: Ç.

While sorting, the list appears as this:

A B Ç C D...

but it should be:

A B C Ç D...

How to fix that? Is it about views or something else like MySQL etc?


texts: What Continuous Integration System is most geared?

texts:
I am looking for a Continuous Integration System to use with Drupal 7. Preferably it should be widely used and easy to support.

Do you have any thought?


texts:
I'm trying to create a voting option for the nodes in my website. I want the voting to look like this

The users click on the vote button and the number increases.

I have tried using the Rate module but it's not working with views or display suite. Is there any other module that I can use which will help me achieve this.


texts: How to build a webform with a slider field

texts:
The Webform module itself doesn't (yet?) support the html5 <input type="range"> element, which isn't really cross-browser compatible yet anyway.  I suppose right now (2013) we're stuck using a Javascript solution, and the most popular solution in the Drupal world seems to be the JQuery UI slider component, via the sliderfield module. However, the module page and issue queue makes no mention of integration with Webform.

I'm wondering if there is a module I've somehow overlooked that does offer slider/range widgets for Drupal Webforms, and if not, what is the most recommendable way to implement one, that could be shared and or turned into a module.


texts: How To Remove Table border or hid to show my page

texts: I made a view and display " tender" and the Page Format is Table and I don't want show the table border how to hide or remove?


texts: How can I stop a message (displayed via drupal_set_message()) from being printed?

texts:
When a node is saved, the Location Taxonomize module by default prints a message if terms are created.  This message is very confusing for my users so I want to remove it.

I found where the message is being displayed in the module's code:

/**
 * @param $items - an array of items ready to be taxonomized
 */
function location_taxonomize_taxonomize($items, $form, &$form_state) {
  $saved = 0;
  $tids = array();
  foreach ($items as $item) {
    $results = location_taxonomize_process_item($item);
    $saved += $results['saved'];
    $tids = array_merge($tids, $results['tids']);
  }
  if (!empty($tids)) {
    if (location_taxonomize_term_attach_enabled()) {
      location_taxonomize_term_attach($tids, $form, $form_state);
    }
  }
  $msg = t('Location taxonomize: @num new terms saved', array('@num' => $saved));
  drupal_set_message($msg);
  return array("saved" => $saved, "tids" => $tids);
}

Obviously I could just delete the line drupal_set_message($msg); but then I would have to do this every update and I would eventually forget.  I'm still learning how to use hooks and I know that hooks can be used to remove form elements but what about status messages?  Is it possible to stop the message from being displayed using hooks and if so, could you please give me some pointers about how to go about doing so?


texts: How to load modal form on page load using ctools?

texts:
I have an issue to show modal form on page load. This form will have 3 steps to submit. I've found CTools will suit the best. I'm newbie in drupal, that's why I've looked all tutorials ctools. Every example article tells how to show modal form by clicking on link. But I can't find any examples, how to load my modal form not clicking on link. I want to call it through AJAX after the page loads, but I don't know how.

Please, give me some advices.


texts: YourTheme_links doesn't work on sub theme

texts:
I have tried the way described in http://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_link/7#comment-24463

But as it seems it works on the main theme but not on a subtheme.

function MYTHEME_link($variables) {
    print_r($variables);
    die;
}

Yeilds no result.

Applied on Zen theme which results the menus.

But on a subtheme it shows nothing. Anyone knows why?


texts: How can I get documentation on a variable listed in the Features UI provided by Strongarm?

texts: When looking through the list of variables provided by Strongarm, there are several that sound like they might be useful to include but what they actually refer to is impossible to guess from the name alone (e.g., mail_system).  How can I quickly look up unknown variables to see what it is that they do?


texts: Restrict administrator users from seeing blocks

texts:
I am using Drupal 6. I placed a JavaScript snippet in a block required by a third-party chat service I have on site.
Now, this block is by default displayed on my administrative pages, which is annoying. Is it possible to restrict the admin role from seeing this block?

I tried this kind of snippet but it doesn't work.

global $user;
if (($user->role) == 'anonymous') {
  return TRUE;
}
else {
  return FALSE;
}

?>


texts:
This feels like a repeat post but I can't find an actual answer. I just installed Drupal 8.4.4 on an Azure App Service (S3 Standard 4core 7GB RAM / PHP 7.0.6) and Azure Database for MySQL (Standard 100 computes / v5.6.26.0). I've been told the host isn't the issue.

Out of the box, the admin side is incredibly slow, like 4-5 seconds per click. I enabled page caching, and CSS/JS are aggregating. Dog slow. I worked through this and created my content types, added a couple of extensions, and enabled BigPipe (reported to help but didn't).

What am I missing? How do I improve performance before I ask my content authors to start loading up content?

Status report from Drupal. (I have since fixed the reported trusted host settings error)

Performance of the page in Chrome. Looks like 2.8s waiting on the page

I created a test.php file, and queried mysql directly, the key_value table, and dumped all of that to the page, about 576 rows, and it returned instantly. Appears to be Drupal specifically?

Devel bar on public page 182 DB queries

Devel bar on admin page 233 DB queries


texts: Use a different theme when your site is being embedded in an iframe

texts:
We have the requirement to make a trimmed back version of the website, for use for other websites to embed via an iframe. For instance, there will be no left navigation, no global navigation, and all elements will be re-flowed to fit in a smaller width.

I would like to do this with a separate theme (more than likely the iframed theme would be a sub theme of the main site theme).

What is the best way to ensure the site loads the alternative theme when it has been embedded (and switch back to the main theme when it is not)?

A thought I had:

Use a different sub-domain e.g. www.example.com and iframe.example.com

I am after what you think the best way to solve this would be


texts: how to assign first img linked on a node to image field

texts:
What I have: a D7 site with around 2k nodes on it, many of these nodes have images <img> in the html of the body but those images are not assigned to the image field. (It is an old drupal site that was upgraded to D7).

I would like to parse all the nodes so that the first image in the body content is assigned programatically to the image field of the node. Manually editing is not an option, as there are over 2.000 nodes on that site.

Is there a way to do that programatically? I guess field api may help (and so my tag) but I dont really know.

Thanks.


texts:
How do I validate the term title in hook_taxonomy_term_presave()?

Is there a way to proceed with the validations in hook_taxonomy_term_presave()?

@Edit

I rendered taxonomy add term form via "Inline Entity Form" module and here form_alter fails when it comes to validation.

Any other way if hook_entity_presave can't do this?


texts: Layout problems (backgrounds and blocks region)

texts:
I'm a non professionist dealing with drupal for the first time and it's killing me. I'm trying to create a page without having to code but it seems impossible! I need to adjust the position of the main menu (how can I move the writings to the center?), then I need to put a background, and basically I need very simple assistance to create this web site for an exam, please help me :'(
(yes, i tried to read the guide on drupal.com but it's too difficult for a non-expert


texts: Running tests on fresh 8.2.x install throws "Permission Denied" for Kernel tests

texts:
Under a fresh install of 8.2.x, when I run tests, only Kernel tests seem to fail with this message from the testing UI:

(path/to/test/Kernel/test.php) ... Permission denied

Pretty much any Kernel test I select exits immediately with that error. Other tests, like Unit tests, work fine. Is this a file permission issue or something I missed in config?


texts: I configured the contact form module core for drupal 7, But the messages are not sent, whitout any error message. I work just in local.


texts: No results behavior in Views PDF does not show

texts:
I'm using Views PDF to generate PDFs with exposed filters (looking for a product by product # and brand name). My view has 10 displays because each language uses its own template (configured in row style). I'm placing each field on the page using x and y coordinates.

I've added a Global: Text area "no products found" message to the "No results behavior" - to show when the filter values do not yield any rows. I'm just getting a blank PDF however - no message is shown.

Is the No results behavior not supported in the Views PDF module? Is there a workaround?


texts:
I'm building a form which should calculate some values during the form view. I've tried to use the computed twig field. The calculation is working after submission and also, when I move to the previous or next page but I want the field to be calculated immediately after the base values has been entered (jQuery/AJAX).

If theres no way of doing it automatically, how can I accomplish this using a "Calculate" button?

I hope somebody can help with this issue or give an example for a form which is using this kind of calculation.

Cheers


texts: Clone object property is automatically referenced?

texts:
I use D6 with filefield, imagefield, imagefield_paths, token, cck. I create a new content type with two imagefields with a default image.

Now every time I test it http://pastebin.com/EXf2R5dA. In fact, token uses drupal_clone then node_view to generates tokens without touching the original object. But in this case it changes.

Do anyone knows what happens? $items in the patch is an array (and is genenated in content_token_values() in cck/includes/content.token.inc).


texts: Move, style or remove title in taxonomy template

texts:
I would like to remove the title from rendering in the natural taxonomy page template so that I can add it in the teaser and reorder the fields. Currently, the title shows first, and then the other fields in the teaser display. When I view the "Manage Display" for the teaser view mode, the title field is "hidden" and if I show it, it ends up appearing twice. I would like to unhide it, define a specific class reorder the fields.

Can this be done without an added module? I have already played around with taxonomy view but am asking for an alternative that doesn't require using the taxonomy view, which I have disabled for the time being. E.g. If I need to edit the template, which template would it be and what specific way does it need to be edited to remove the title? My site is complex with a bootstrap theme and a sub-theme that I purchased as well as my custom modifications.

See screenshots below for a visual.

Teaser with title hidden

Shows title at the top without defined class

Teaser with title shown and class defined

Shows title twice

I want to make the one at the top go away or show it where the other one is with the proper class.

Bonus:
I really want to add author and date information like in the screenshot below to the taxonomy template, which I pulled from my taxonomy view version before I disabled it.


texts:
I enabled a migration module. Now I would like to make some changes inside the yml file. How can I update my migration?
I use  migration plus.


texts:
Is there anyway 'odd' and 'even' classes can be attached to node teasers so that they can be striped with different colored backgrounds?

In the same way that table rows can be striped.


texts: Combining several attributes with string join

texts:
My XML is structured like this:

<Export>
  <ProductType Type="Book">
    <Products>
      <Product Title="The Pragmatic Programmer">
        <Chapters>
          <Chapter Title="1 A Pragmatic Philosophy">
          <Chapter Title="2 A Pragmatic Approach">
          <Chapter Title="3 The Basic Tools">
          ...
        </Chapters>
      </Product>
    </Products>
  </ProductType>
</Export>

I am trying to map an XPath Expression to a multivalue field that contains a list of all the chapters.

I think the context expression is causing the xpath function for the mapped field to return an empty value.

I've tried the following and both do not work:

Context:
/Export/ProductType[@Type='Book']/Products/Product

Target Field:
fn:string-join(Chapters/Chapter/@Title, ', ')

This just outputs a comma.  Is there a way to combine all of the Chapter titles into one string like "1 A Pragmatic Philosophy, 2 A Pragmatic Approach, 3 The Basic Tools"?

UPDATE

I'm not sure that you can use expressions in string functions, but this stackoverflow post lead me to believe that it is possible.


texts: How can I query on a custom content entity base fields?

texts:
I am trying to write a entityQuery and add condition on the base fields I've defined.

The query:

$query = \Drupal::entityQuery('map_object')
    ->condition('body', 'Test')->execute();

And the error:

Drupal\Core\Entity\Query\QueryException: 'body' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 316 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

The definition:

    $fields['body'] = BaseFieldDefinition::create('text_long')
      ->setLabel(t('Body'))
      ->setDescription(t(''))
      ->setDisplayOptions('view', array(
        'label' => 'hidden',
        'type' => 'hidden',
        'weight' => 0,
      ))
      ->setDisplayOptions('form', array(
        'type' => 'text_textfield',
        'weight' => 9,
      ))
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);

The column "body" does exists in the entities base table.


texts: Access Individual Fields - Contact Form - Swiftmailer

texts:
So I followed the steps here https://drupal.stackexchange.com/a/199464/49661 to configure Drupal 8 to send contact form emails via Swiftmailer.

I created a template in my theme's template directory, swiftmailer.html.twig, which the emails do seem to be using. The issue is, I only seem to have access to all the fields at once using {{ body }}. This just spits all the field values out in one, giant mess. Random spacing everywhere, random new lines, some fields with labels, some without.

Ideally, I'd like to be able to access individual field values so I can template it. For example:

Full Name:
{{ fields.full_name.content }}

I've tried kinting a few variables out, but all body contains is the cluster of every field value together.

I've also tried creating more variables using [yourtheme]_swiftmailer_preprocess(&$variables) after reading very little documenation available here https://www.drupal.org/node/1590184. This doesn't even seem to be ran when a contact form submission is made.

Here's what it looks like when I kint out body|raw:

Thanks for any help in advance


texts: why is the node id missing from the comment:edit action?

texts:
When I setup a trigger on comment creation and edit that fires the action "send email" I have the folling tags available in the action editor that seem to be missing the nid on output:

[comment:edit-url]
[comment:url]
[comment:url:absolute]

This gives me the following output in emails

http://example.com/comment//edit
http://example.com/comment/#comment-
http://example.com/comment/#comment-

Is this a flaw in the D7 or and I not doing it right?

Thanks in advance for any insights.


texts: How to edit every node of a content type on cron run?

texts:
On cron runs, I want to edit every node of a certain content type. I think this is implemented through hook_cron() but I can't find any documentation about this hook. How can I edit every node of a certain content type on cron runs?

I need this because I update content on nodes based on another website. I want the content to be updated regularly. I need something similar to feeds but the data source is just HTML not xml.


texts:
I have tried doing this in hook_node_view or  hook_node_view_alter with no luck:

I have tried things like:
     unset( $node->title); or
      $node->title ='';

note: my node was created using panel nodes


texts: overloading the destination url of privatemsg

texts:
I have a privatemsg message form, and I need to alter the success URL that loads when a message is sent. What is the easiest way to go about doing this? The code i'm using is more or less based on the example code used here:

 module_load_include('pages.inc','privatemsg');dru
 print drupal_render(drupal_get_form('privatemsg_new'));


texts: How to remove title field from content edit page?

texts:
i want remove field title in any content type on drupal 7. i use module display suite and hidden title but when i add new content that "title is required .......................................... ". thank you for help.

i want remove title field in any content type.


texts: How can I set up a "many to many" relation with an entity

texts:
How do I set up n:m database relation in a custom Drupal 8 module?

I want to create task entities that may be related to different users (a task may have multiple related users and a user may have different tasks).
Using the database directly I would create two tables(as the user table already exists), a tasks table and a task_users table which contains the relations (User IDs and Task ID)s.
How do provide something like this in Drupal 8?

I only find a way to handle 1:n relations in setting up a user reference field (entity_reference) as a base field definition.

$fields['user'] = BaseFieldDefinition::create('entity_reference')

But how do I provide a relationship table?


texts: Show entries in view only if other nodes with same term reference exist

texts:
I have a view of several fields from one content type (content type is called "summary"). A required field in the content type is a term reference, called "connector". "connector" is also a required field in a different content type ("details"). I only want to include the content of a node summary in the view if a node details exists with the same "connector" reference.

Is this possible when using views? Using the interface would be ideal, but since I am already doing some post-rendering for that view, it might be easiest to remove the unwanted entries there?

From what it sounds like, it should be possible to do this using the relation module. However, I can't wrap my head about how to configure it.

Any help highly appreciated!


texts:
We have a content type that has a Video Embed Field. In this field, we simply enter youtube or Vimeo url.

In a custom view we are trying to display the raw value of the field.
Since this is a Video Embed Field, the only formatter in Views are to display the video or a thumbnail of it.

The problem is that we want to display just the raw value of this field which will be the video url.

Are there any workarounds that will allow us to display the raw value of this field when added in a view?


texts: I need to use hooks without using theme and module

texts:
I'm in a project that needs to add features to Drupal Core without using themes niether modules.

I have implemented a class that makes different things, but I need to use hooks or something similar. Maybe I'm mistaken, but hooks must be implemented throught a module or a theme. Can I do this kind of paranoia?

Thanks!!


texts:
I am developing a site and am getting a few warning messages that cover the page. I want to deal with them later and turn them off for now so I can concentrate on theming.

I've tried going to Config>>Development>>Logging and turning them off from there, but although it says the save was successful refreshing the pages shows the 'All Messages' option is still selected and the messages still appear on the front end.

I searched how to do this in Drush and tried drush vset -y error_level 0 and drush vset error_level 0 and got the response "error_level was set to 0." but this too had no affect.

I've tried clearning my cache after each attempt as well.

Would anyone know how to achieve this?


texts:
$form['search_results']['file_upload'] = array(
'#type' => 'managed_file',
'#title' => t('Thumbnail'),
'#default_value' => variable_get('file_upload'),
'#upload_location' => 'public://uploads/');

When using this, should managed_file create folder "uploads" if folder doesn't exists? If folder exists, regular users can't upload to that directory because of folder permissions, how to change that?