texts: Working example of blueprint (subrequest) to create a paragraph and associated entity?

texts:
I'm using the subrequests and paragraphs modules.  Without a code example, it's daunting to try to build a working blueprint for the subrequest, when I haven't used either module before.

I have consulted the output from the openapi module, which attempts to document the body structure for each entity.  However, this documentation is not very helpful in building a blueprint for a subrequest, partly because it appears to include many keys that won't be necessary in the blueprint.

I'll post a code sample representing my best current guess, but it's not close enough that I have even tried a request:

  var my_entity_type = 'apples'
  var my_paragraph_type = 'oranges'

  var body1 = {
    "data": {
      "type": my_paragraph_type,
      "attributes": {
        // I don't know if it's necessary to pass attributes when first creating the paragraph.
      }
    },
    "relationships": {
      "?????": {
        // Yes, my paragraph type itself has relationships.  Not sure if I will need to get
        // all the syntax right to see a good result, or if I can build up to it.
      }
    }
  }

  var body2 = {
    "data": {
      "type": my_entity_type+"--"+atype,
      "attributes": {
        "name": {
          "value": input.label
        },
        "notes": {
          "value": input.notes
        }
      }
    },
    "relationships": {
      "products": {
        "data": {
          "type": "paragraph--"+my_paragraph_type,
          "id": "{{/req-1@/data/uuid}}" // Pure guess.
        }
      }
    }
  }

  var auth = myAuthObject

  var blueprint =
  [
    {
      'requestId': 'req-1',
      'uri': '/paragraph/'+my_paragraph_type,
      'action': 'create',
      'body': body1,
      headers: {
        'Authorization': 'Bearer '+auth.access_token,
        'Content-Type': 'application/vnd.api+json',
      },
    },
    {
      'requestId': 'req-2',
      'uri': '/my_entity/'+my_entity_type,
      'action': 'create',
      'body': body2,
      headers: {
        'Authorization': 'Bearer '+auth.access_token,
        'Content-Type': 'application/vnd.api+json',
      },
    }
  ]


texts: Migrate files from directory to Drupal using Migrate

texts:
I have a folder with a large amount of files in. I need to migrate this into Drupals file system so I can then reference them in the content.

The ID of the file is the actual name e.g. 1234.jpg

What's the best method of doing this? I think I have the destination method set using MigrateDestinationFile()

I could write a script to create an xml document which defines every file in the folder and then extend the XMLMigration class and use that but it seems a bit overkill? Are there any source methods that would help with this?


texts: How to add twitter tracking code to a Drupal site?

texts:
Twitter now creates code to track visits to your site from twitter.  https://support.twitter.com/articles/20170807-conversion-tracking-for-websites#

Where would be the best place to put this code, into a template? is there a module for this like there is for google analytics?


texts: How to print a field value in page front tpl file?

texts:
I'm trying to load a field value (machine name: field_theme_image) from a content of node value 3, in "page--front.tpl.php".

<?php
  $node=node_load(3);
  print $node->field_theme_image[$node->language][0]['uri'];
?>

Using the above code I'm not getting full URL value. Please see the image below. I can see the path value in Devel themer.


texts: Views Rss - How to set pager options / items to display via URL argument

texts:
I have a RSS feed being built by the Views RSS module. I can configure the pager to display a certain number of items; however, some consumers of my feed only want a few of my latest items from my feed. So I need to pass a limit in the URL to the number of items in my feed.
something like this:

www.mywebsite.com/rsslatestnews/50 - For 50 items.
or
www.mywebsite.com/rsslatestnews/2 - For 2 Items.

I've tried implementing the hooks:

hook_views_pre_build
hook_views_post_build
hook_views_pre_execute
hook_views_post_execute
hook_views_pre_render
hook_views_post_render

To no avail, I think the RSS Views module is in some way skipping
the typical order views hooks are triggered.

My question is this:

Which hook can I use to set the limit of items displayed by my RSS view?


texts: Can no longer run "composer require drupal/swiftmailer"

texts:
I have a module that relies on swiftmailer, and needs the libraries installed. Whenever I've needed to install swiftmailer libraries to a Drupal environment, I've always run this command:

composer require drupal/swiftmailer

This no longer seems to work. Running this now prompts me for authentication to git.drupal.org, and I don't understand why. Apparently this isn't the same as my drupal.org credentials:

I'm not extremely familiar with Composer and am wondering what I can do here.


texts: Send email to all users of a role except certain users?

texts:
I'd like to send an email to a users of a certain role.
I've already did it with Rules module, but now I want to expand my rule and send email to only certain role's but to a specific users of that role.

Example:
Send email to a role admin, except user with name or email (test/test@test.com)

Is it possible to do it via Rules module or maybe some custom executable PHP code?

Thanks in Michael.


texts:
I have a progressively decoupled Reactjs application running on top of Drupal. Its a multilingual application.

I need to fetch the translated strings from the Drupal itself and handle the translations editor and everything in Drupal itself, rather than maintaining a separate translation system for react.

How is it possible? A simple Drupal.t() doesn't work. I checked.

Any examples I can refer?


texts: I would like to use user-submitted data from one form field and add it to anther field, then submit the form to create a node that has my custom data. I'm having a hard time doing this. Any help is appreciated.


texts:
We are using WYSIWYG with CKEditor on Drupal 7.

When the edit button on a node is clicked, the edit page shows text in a jumbled mess, even if there was careful formatting. The text formats have the "Convert line breaks into HTML" filter enabled,  as well as having the <p> and <br> tags allowed.  As per a comment, I have taken these tags out of the allowed HTML on the filtered HTML format.

WYSIWYG Linebreaks is enabled as well, but doesn't seem to solve the issue.

If breaks are added in, they seem to stay, even when editing the text again.

My question is: What is causing this formatting to break, upon clicking the edit button?

Example of ruined formatting:

On the left is what you see when viewing the page before it has been edited (i.e. the page was written by someone else), and on the right is the jumbled mess that is the edit page. On the edit page, all the paragraph or line breaks have been removed.


texts: Moving Host - concern about PHP memory limit

texts: I'm moving my projects from Bluehost to GreenGeeks, and I'm concerned about the Drupal (v7) PHP memory limits.  Maybe I'm overly concerned, but has anyone experienced any issues with GG or BH about running Drupal for clients' commercial projects requiring more than average PHP memory levels above 64meg to a max 128meg memory requirement. Any comments welcome.


texts: How to change query target when using EntityFieldQuery

texts:
I'm using EntityFieldQuery and want to change the query target to something other than 'default' (because I'm using DB replication with the help of autoslave module).

It's easy to do that when using db_select or db_query by setting 'target' key on third $options parameter.

EntityFieldQuery class doesn't have any method for that and I tried to use hook_query_alter but no luck there too.


texts: Change block location on page by page basis?

texts:
I am working on a custom theme that's inheriting defaults from Bartik. I want to specify that the 'recent content' block should appear in the content area on the homepage, but the left sidebar on article pages.

I see how to specify a specific area for the block on a specific page, but no way to set a different area on a different page or duplicate the block. I'm thinking it might be most logical to duplicate it, so I have front-page recent content and regular recent content, since they might look a little different. But not sure how would I go about doing that?


texts: How to change date format in the webform date element?

texts:
I have added a date element to my webform.
Now I want to change the date format for the date element.
I have used the following code.
function my_module_webform_element_alter(array &$element, FormStateInterface $form_state, array $context) {
  if ($element['#type'] === 'date') {
    $element['#date_date_format'] = 'd/m/Y';
  }
}

But I can still see the date element like this.

And when I try to submit the form and I get an error on date field.
Also is there a way to change the date format in the email which webform sends?


texts: How can I control block visibility with code?

texts:
In Drupal 6, I could control block visibility using PHP code in the block UI configuration like:

<?php return MYMODULE_abc() || MYMODULE_def() ; ?>

These functions looked up the current node, taxonomy, etc. to decide on whether to display the block. This PHP option is gone in Drupal 8, but there is a $visibility field in BlockBase. Can I use this to programmatically set the visibility at runtime?


texts:
I wanted to make some customizations to the "Seven" administration theme, so I started by installing the "Blossom" sub theme of Seven found here: http://drupal.org/project/blossom-admin .

This worked fine.  So then I copied /sites/all/themes/blossom-admin and named it /sites/all/themes/myadmin

In the .info file for myamin, I changed

name = Blossom
description = Drupal Gardens administration theme.

to

name = myadmin
destription = my description of this theme

And just to be safe, I also renamed any files that had the "blossom" name to "myadmin" in both the .info file and to the actual files themselves.  (Like renamed blossom.css to myadmin.css)

Now when I go to the Drupal admin and select myadmin as the administration theme, it works, but includes my main navigation and a footer region content at the top of the theme.  Does anyone know why this would happen to a straight copy of the blossom theme which worked fine?


texts: Setting custom block.html.twig templates in preprocess function (not based on twig naming scheme)

texts:
I've created several block plugins each with their own block form. My goal is to make it so you can select what template to use based on a field in the blockForm. I understand that I can change a block template within the build function by specifying the '#theme' but that refers to the content. I want to change block.html.twig template being used that surrounds the content.  I also understand that I can specify the block template by using the naming scheme like block--block-name.html.twig but I want to be able to select the template within a preprocess function. Below is my attempt.

In mytheme.theme I have

function mytheme_theme($existing,$type,$theme,$path){
    return [
        'wide_grid_block' => [
            'variables' => [
                'test' => 'Test default value',
            ],
        ]
    ];
}

function mytheme_preprocess_block(&$vars){
      $vars['#theme'] = 'wide_grid_block';
}

and in templates/block/wide-grid-block.html.twig I have

Testing: {{ test }}

I assumed the what should occur is that every block should use the wide-grid-block.html.twig file. But they're all still using block.html.twig.

How do I specify a custom block template in a preprocess function?

UPDATE: I've also tried using a theme_suggestions_block_alter hook but I get a white screen when attempting to do so

function alltechcom2017_theme_suggestions_block_alter(array &$suggestions, array $variables) {
$suggestions[0]= 'wide_grid_block';
}

And I've tried with and without the [0]

UPDATE 2: I've managed to add to the suggestions by using

$suggestions[] = 'wide_grid_block';

The issue I had before with the white screen was because the file was in the wrong location. So I know drupal can see it, I just need it to be the most desired one in the list of possible templates.

In the debug info I see

<!-- FILE NAME SUGGESTIONS:
   * block--product-selector.html.twig
   * wide-grid-block.html.twig
   x block.html.twig
-->

And I have a block.html.twig and a wide-grid-block.html.twig. Why is it using block.html.twig instead? It's acting as if my file doesn't exist. I looked at this https://sqndr.github.io/d8-theming-guide/theme-hooks-and-theme-hook-suggestions/theme-hook-suggestions.html and it appeared like I was on the right track.

UPDATE 3: I've added

function mytheme_theme($existing,$type,$theme,$path){
    return [
        'wide_grid_block' => [
            'path' => drupal_get_path('theme','mytheme').'/templates',
            'template' => 'wide_grid_block',
        ],
    ];
}

but still no luck


texts: How to set drush alias for remote site behind jump server?

texts:
Drupal 8 site (8.5.3) with drush 8 (8.1.16) both equal on local and remote. Connection to remote is through jump server - log in to jump (ssh -L 2004:remote.com:22 -l username jump.server.com), in other terminal connect to the remote (ssh -l username -p 2004 localhost). All this work fine. I keep these connected, and test drush in third terminal.

Aliases are at drush/aliases.drushrc.php in project dir.

$aliases['site.r'] = [
  'root' => '/home/username/drupal8/web',
  'uri' => 'http://remote.site.com',
  'remote-host' => 'localhost',
  'remote-user' => 'username',
  'ssh-options' => '-p 2004'
];

drush @site.r status -v show me that the aliases are found but result is from local installation.

edit:

sve@eb850 .../panel-d8.local/web (master>) $ drush @kp.r status -v
Loaded alias @kp.r from file                                            [notice]
/var/www/vhosts/panel-d8.local/web/../drush/aliases.drushrc.php
Loading outputformat engine.                                            [notice]
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php/7.1/cli/php.ini
 PHP OS                 :  Linux
 Drush script           :  /var/www/vhosts/panel-d8.local/vendor/drush/drush/dr
                           ush.php
 Drush version          :  8.1.16
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :

Command dispatch complete                                               [notice]

edit 2: This is a sub-site of multi-site, drush aliases works on local and remote by self in right way.

What is wrong?


texts: Multiple forms and required fields affecting hook_form_FORM_ID_alter()

texts:
When creating a new content type, the $form_id is correctly picked up in my module.  Let's say in my example, my form is called the 'foo_form'.  The below hook_form_FORM_ID_alter function works fine when I go to add/content/foo-form

function MyModule_form_foo_form_alter(&$form,&$form_state,$form_id) {
  echo 'It works!';
}

The problem is that my content type has some required fields.  If the user does not fill them in all out and submits, then the submission fails as expected.

The problem is that now on the error page telling the user that he or she needs to fill out the required fields, the $form_id is no longer 'foo_form', but instead named 'search_block_form' because on all my pages I have a search block on the left side bar.  Now my hook_form_FORM_ID_alter() does not get invoked because my module is getting 'search_block_form' as its $form_id instead of 'foo_form'.

I tried using hook_form_alter(), which works globally, but because there are 2 $form_id's on this required fields error message page, my MyModule_form_foo_form_alter() gets called twice (once for 'search_block_form' and 'foo_form')!

How do I resolve this issue, other than exclude displaying the search form block when adding new content?  How do I make 'foo_form' the primary $form_id???? I find this odd since if I go to add a new content, Drupal is "smart" enough to ignore the 'search_block_form' $form_id.

EDIT: My code to test visibility about what $form_id's are present before submitting and after submitted without filling in all the required fields.

function MyModule_form_alter(&$form,&$form_state,$form_id) {
  case 'search_block_form':
    //this one always shows up
    echo $form_id . "
";
  break;
  case 'foo_form':
    //does *not* show up when submitting form
    //with missing required field values
    echo $form_id . "
";
  break;
}


texts: Showing a block in specific content types and URLs

texts:
I have a block I want to show in specific content types and some URLs.

I tried adding the following code.

  $match = FALSE;
  // block is visible on the content types entered here
  $types = array('story' => 1, 'page' => 1);
  $url = request_uri();
  if ((arg(0) == 'node') && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    $match = isset($types[$node->type]);
  }
  // block is invisible on URLs entered here
  if (strpos($url, "edit")) {
    $match = TRUE;
  }
  // copy paste these for additional URLs
   if (strpos($url, "taxonomy/term/8")) {
    $match = TRUE;
  }
  return $match;

Is it possible to use wildcard or something to include all the child in this taxonomy, instead of using taxonomy/term/8?


texts:
In a first try to setup a multi-site configuration, I run into the following problem : anything done with a site (pictures, styles...) is added to sites/default/files/ directory, and an image added to a content points to sites/default/files/styles/some_style/.../image.jpg.

Is it the expected behaviour ? I thought any file would stay in sites/site1/files...

This is my sites/sites.php  :

$sites = array(
  '8083.arbre.dd' => 'arbre.dd', //local devdesktop site
  '8083.site2.dd' => 'site2.dd', //future one
);

I have folders sites/all, sites/default, sites/arbre.dd, sites/site2.dd.
I added a files directory and a settings.php file to the future site folder.
I notice that the arbre.dd folder added by Devdesktop at initial setting, has a shortcut icon ???


texts: For each image uploaded in a node: get the url

texts:
I'm begining with Drupal 8 and I want to get the url of the photos in the content I create to display them.
 The context is : a photograph upload pictures for a customer. This customer can see it on a page. To get this data in common I created a content for my shooting with an id.
 What i did is :

$photos = $shooting->field_shooting_photos->target_id;

This allow me to get the id of every pictures uploaded.
Now I want to do a foreach on $photos in my .module that will return every url in an array.
Then I will use this array in my Twig and do a foreach on it too to return every photos.
I just can't figure out how to do, I think I will have to use something like that

$path = $photo_id->getFileUri();

but I can't figure out the syntax to get it into an array.
Thank you for your help!
Solution :
Here is what I did in case it can help someone :

$photosTest = $shooting->field_shooting_photos->referencedEntities();

$photoUrls = [];

foreach($photosTest as $media) {
  $photoUrls[] =
  $photoUrls[] = [
      'render' => [
         '#theme' => 'image_style',
         '#style_name' => 'medium',
         '#uri' => $media->field_media_image->entity->getFileUri()
       ],
       'href' => $media->field_media_image->entity->getFileUri(),
     ];
}

In my Twig file I render the array :

 {% for photo in photos %}
    {{ photo.render }}
 {% endfor %}


texts: Table in custom form + empty values in form_state

texts:
In a custom form I created a table element:

  // Table results.
  $form['table'] = [
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => ['id' => 'table-results'],
    '#empty' => t('No results.'),
    '#prefix' => '
',
    '#suffix' => '
'
  ];

This table is ajaxified and updated when I click on a specific button.

I need to get the output HTML of this table in another function. If I use a dpm($form_state->getValue('table')); I get an empty array. Yet, the other values (of other fields) are accessible in the $form_state.

// My second function
public function secondfunction(array $form, FormStateInterface $form_state) {
  dpm($form_state->getValue('table')); // -> empty value...
  dpm($form_state->getValue('textfield')); // I get a value
}

What do I change in my code to solve this problem?


texts: How to Delete Distribution Profile convert to Standard

texts:
We are using OpenSocial distro and because our direction has changed we no longer need to use distribution. Therefore we need to go back to the standard installation.

Is it possible to move all the modules and remove the OpenSocial profile and basically convert the site to standard installation? The site is managed with the composer.


texts: Term reference with radio buttons + bootstrap tooltip

texts:
In the details of a user I have a term reference that is presented as radio buttons. You can select one radiobutton. The html looks like this:

        <input type="radio" id="edit-field-abonnement-und-2" name="field_abonnement[und]" value="2" class="form-radio">
        Abonnement 1

        <input type="radio" id="edit-field-abonnement-und-3" name="field_abonnement[und]" value="3" class="form-radio">
        Abonnement 2

        <input type="radio" id="edit-field-abonnement-und-4" name="field_abonnement[und]" value="4" class="form-radio">
        Abonnement 3

        <input type="radio" id="edit-field-abonnement-und-5" name="field_abonnement[und]" value="5" class="form-radio">
        Abonnement 4

But I would like to have a tooltip on each div. I can add a javascript file and send some data to the javascript and set the title with the data (I would do this with taxonomy_term_load).

But how can I get a structure like this and make sure the tooltip works?

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>


texts:
What does maintenance mode actually do?  I'm not asking for a high level overview, nor am I asking for a code dump.  I'm asking for a technical, functional definition.  What does maintenance mode actually do?  Does it shut down everything for all users except admin and just show them a static page?
Is there a technical reference (short of the code itself) that covers what maintenance mode actually does?


texts:
I have a content type called 'microblog', and a default input format for registered users is set to 'Filtered HTML', meanwhile i want to use 'Messaging plain text' format for creating a microblog content.

<?php
$content .= check_markup($node->title, $format = 'Messaging plain text', $check = TRUE);
?>

But it seems like drupal ignores $format, still when im posting microblog content it uses 'Filtered HTML' format.

PS i'm using http://drupal.org/project/microblog module.
Tried to change in microblog.module on 380 line to 'Messaging plain text' - still no effect...


texts:
While adding a new submit button to the form
$form['actions']['save_as_draft'] = [
  '#type' => 'submit',
  '#value' => t('Save as Draft'),
  '#submit' => ['::submitForm', '::save', 'save_as_draft'],
  '#validate' => [],
  '#limit_validation_errors' => []
];
$form['#validate'] = [['validate_errors']];

This does not save the entity. I am not sure how to edit the following validate function.
function validate_errors(&$form,FormStateInterface $form_state) {
  if ($form_state->getTriggeringElement()['#value'] == t('Save as Draft')) {
    // Skip validation.
  }else {
    // Validate here.
  }
}

Meanwhile, I got the error when saving (Entity validation was skipped):

Any inputs on how I can fix this and allow the entity to be saved without validation?


texts: Sort a view by country - according to the translated countries

texts:
I have a view displaying some nodes of a content type. Each node has a location assigned (with the location module).

I want to group and sort the results by countries. The grouping works fine, and the sorting is almost fine too.

It does sort by country, but it does it using the english countries' names.

However, my website is in french, so I want it to sort using the french countries' names.

Most of the countries are fine, but some are not the same. For example: South Korea is Corée du Sud in french, so it's not the same order.

Views uses the english name to sort, I want it to use the current language (here french, but it's a multilingual website, so also english when it is).


texts: How to remove ":" (colon) when displaying field name?

texts:
I created a custom content type with some text fields. In the view settings of that content type I defined both to appear and as well their titles (names of the fields) to be displayed above the content of the fields respectively.

But how can I remove the trailing colon of the titles? Is there a way of modifying the way field names are display just for certain content types? I do not want this altered site wide (e.g. for all fields of all content types).

PS: I'm already using the "views" module to define a special layout for this custom content type. Probably there is a way to carry out these changes with the help of the "views" module and a custom layout template?

/edit/
I did not create a view (as with the "views" module) to display that content but used Drupal's own content type view configuration (maybe called "display"). I'm working with a localized Drupal and retranslating the different words.

Remark: Using Drupal 7.10 with Views 7.x-3.0-rc3


texts:
Can anyone tell me if there's a way to use hook_form_alter, or some other approach, to insert an extra column with to a views generated table.

I am trying to insert some buttons which will update node data when a user clicks on a relevant button.


texts: Validate based on existing CCK field value?

texts:
I have a content type with an address field in it. My client has requested that when saving, the site should check whether another node (of the same content type) already has that address.

I.e., I want the content type to validate if and only if the address being given hasn't been used.

How do I do this? Using Drupal 6, by the way.


texts: Adding form elements with jquery to a drupal form

texts:
I have a recipe form under node.  Up until now, I had a button that would add another ingredient textfield by updating that section of the form with an ajax call.  I can no longer do this.

Now I have a button on my form that instantly adds ingredient fields to a form without making a call to the server.  The problem is even though the new fields are attached to my ingredient table, the server will not process these new fields.

Is there a way to get Drupal to recognize that I have added fields to a form and show this on the form_state?  Thank you!  any help is greatly appreciated.


texts:
In the current set up for every English page, there's a Spanish equivalent.  Each page has its own unique URL.

Previously we had it set up so that you could click "Spanish" within the English page and it would call the Spanish URL and visa-versa.

We've been asked to make it global -a button at the top of the site.

Is there a clean way to detect what the Spanish equivalent is of the current page with PHP and make the switch?


texts: Render an entity in a string and return it through an AJAX callback in a custom form

texts:
I use the code snippet from:
render a drupal 8 entity in a string

$node = \Drupal::entityManager()->getStorage('node')->load($nodeid);
$view_builder = \Drupal::entityManager()->getViewBuilder('node');
$renderarray = $view_builder->view($node, 'full');
$html = \Drupal::service('renderer')->renderRoot($renderarray);

It works in a normal controller class without problems. But I did not get it to work in an Ajax Callback in a Custom Form.

The $html = \Drupal::service('renderer')->renderPlain($build);  returns nothing.

Where ist the problem? Here is the reduced code of my test form:

<?php

namespace Drupal\mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class SearchApiPageBlockForm extends FormBase {

  public function getFormId() {
    return 'search_api_page_block_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state, $args = array()) {

    $form['form']['actions'] = array('#type' => 'actions',);
    $form['form']['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('TESTBUTTON!'),
      '#ajax' => array(
        'callback' => '::myAjaxCallback',
      ),
    );

    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
  }

  public function myAjaxCallback(array &$form, FormStateInterface $form_state) {

    $view_builder = \Drupal::entityTypeManager()->getViewBuilder('comment');
    $storage = \Drupal::entityTypeManager()->getStorage('comment');
    $node = $storage->load(103); //cid 103 already exists
    $build = $view_builder->view($node);

    dpm('before rendering'); // -> dpm output is: 'before rendering'

    $html = \Drupal::service('renderer')->renderPlain($build);

    dpm($html);// -> dpm has no output
    dpm('after rendering');// -> dpm has no output

    }

}

My goal is, to return the html of an entity via the

$response->addCommand(new HtmlCommand('#testtmp_message', $output));

UPDATE: Content of build:
dpm(build)


texts: How to do System Tests / Functional Tests with an existing database

texts:
the last few weeks and days I have been reading into Drupal 8 testing with phpunit.

For a project I want to use Unit testing to test out functionality and services and the cooperation between different components.

Run the tests against an existing database / installation and not against a fresh Drupal installation, since we have configured a lot already and I need to make sure the new code does work with the whole configuration and data.

I can Unit tests to test out simple functions or classes but what I cannot use is the BrowserTests or KernelTest bases since they all create a new, fresh installation.

Maybe I have misunderstood something or I am on the wrong path.

Can anybody help me out or has an example on how to do that?


texts: How to send email depending upon hidden component value (which will get from url)?

texts:
xxx.com/apply-job/node/1949?jobCode=IR/001&functionalArea=HR

I have a form in the above url, the form components are

Name

Email

Resume

And also I have jobcode, functionalarea as hidden field, those field default value is

%get[jobCode], %get[functionalArea]

My question: How to send email to different address depends upon the hidden component value (functional area component)?


texts: How to hide blocks based on content type or for specific nodes?

texts:
In some of my nodes I need to show only "body" part of node. I don't want to show blocks etc. in those nodes. How can I do this ?

Create a new "content type" and put the data from existing nodes to that type of node. And excluding that "content type" from each of the blocks.
By using javascript/jquery like: $('div'.block).remove()

Any more elegant answers?


texts: How do I append something to a node when it's in detail page

texts:
I'm writing a module that appends content to a node. I'm doing this using hook_process_node :

function mymodule_preprocess_node(&$variables) {
  $variables['content']['body'][0]['#markup'] .= '
My content
';
}

How can I put a condition here to tell Drupal to only append content when the node is being displayed on a detail page, i.e. not in an index page?


texts: How do I change language from <html lang="en"> to <html lang="en-GB">?


texts:
Wordpress comment form contains a text field where visitors can enter a link to their website. Is there any module ( or simple way )to achieve the same thing in Drupal ?

What I'm really looking for is a solution that:

adds a new field to the comment form that needs to be validated as a link
when the comment is displayed , the username needs to link to the website entered in the form , not to the user profile as it does by default.


texts: How to remove overlay hashtag and trailing menu from the parent overlay

texts:
Lets say for example we have activated contextual links & overlay modules and when clicking the edit button for the node, which is all the way bottom of the page, it open on overlay. Now when we look at the address bar the link now looks something like this http://localhost:8888/node#overlay=node/25/edit%3Fdestination%3Dnode

The problem with overlay is that it pushes the parent overlay to scroll all the way to the top and when I decide to "cancel" editing I have to scroll all the way to bottom again just to reach the node teaser. So I need to remove the this part from the link above #overlay=node/25/edit%3Fdestination%3Dnode

Now I guess it is being caused by jquery bbq feature. And looking into overlay module and her js files I find it very scary and dont know how to avoid this.

I need some help on where to look into this for starters like me.


texts: How do I distinguish menu items without children and display different content in panels or views?

texts:
I have a taxonomy based menu (3 tiers) that displays a specific content type.  Content items are always tagged at the lowest level child (*) so when the menu items are selected a range of content is displayed.

top-level | mid-level1 | child1*
          |            | child2*
          |
          | mid-level2 - child3*
          |
          | child4*

When the parent levels are selected, I would like a summary page for the parent to show. I am using views and panels and getting the lowest level children to show is easily accomplished, but how do I set a filter or context to determine if the view is not at the lowest level?

Panels exposes a context that selects content with a parent (or not) so I can easily identify the top level menu selections, but the bottom children can occur at either level two or three and there is no context for 'has children'.

What can I use as a context to select the parents and which hook to use?


texts: Live site still taking nodes url as localhost/

texts:
I have developed a Drupal site on localhost; I then exported it to a production site, and made the required changes in settings.php.
The index page opens fine, but when I log in, the URL is still referring to localhost.
I tried to set the base URL in settings.php, but it did not help.

I am using Drupal 7.10.


texts: How do I disable a core installation profile?

texts:
There is the Allow install profiles to be uninstalled issue that doesn't allow installation profiles to be uninstalled. Is there any way to do this in D7?
(With a little more effort if necessary.)

When you install D7, you typically have to choose an install profile; this could be the "standard" profile shipped with Drupal core. Once installed, the install profile will sit in the "system" table forever, with no obvious way to disable it.

Is there some more hackish way to disable the install profile.

To harmonize the question with the accepted answer even more, I extend the question to: If the install profile cannot or should not be disabled, then can it be replaced at least?


texts: using same addressfield for profile2 and commerce module

texts:
I have a site with two different profiles (with different fields) where one of these are able to buy a product. In this context I want to use the same addressfield for one type in the billing information making automatic filling of a company's address.

I've tried Commerce Customer Profiles module however it seems that I am unable to merge these fields. Does anyone have some suggestions on how to use profile2 information in commerce module?


texts: How can I give permission to authenticated users to edit the content type 'ABC'?

texts:
we have view and edit tab for any content

How can I have such a view and edit tab for authenticated user ?
I have given the following permissions to content of type 'ABC'
- Create own content
- Create new content
- Edit own content
- Edit any content
- Delete own content
- Delete any content
- View published content
But still the authenticated user cannot edit the content of type 'ABC'?
How can I achieve it?

When I try to access node/205/edit page as an authenticated user

I get the access denied message

DNA image


texts:
I have a view that outputs a list of email addresses.

I'd like to find a way to set up a mailto: link that contains all of those as one comma-separated list.

Could anyone advise?


texts: How to send forget pass email programatically?

texts:
I implemented Decoupled Drupal in one of my projects, one of the features I need to implement is a forget password feature. So I created a custom route to listen to reset password requested.

I know I can create a reset password URL with user_pass_reset_url(); I can generate this link and programmatically set the email to that user, but I am looking for a service or Drupal core functionality to achieve this job.

How can I programmatically send a reset password email?


texts: Creating a ticketing system in Drupal 8. How to change a node's field value without going to the edit page?

texts:
I'm creating a simple ticketing system in Drupal 8 to log my daily tasks. The content type contains title, body, and ticket status. The status field can be new, in progress, or completed. When I create a new ticket, the status is set as new by default. I also have commenting enabled on this content type.

The issue I'm having now is the UX of this setup. I can comment on the ticket fine, but if I were to change the status of the ticket to in progress or completed, I'd have to goto the edit page of the node and make this change. How can I change the status value without going to the edit page? Is there a ajax field update feature?

I wan't to be able to make my comment and also change the status of the ticket all at once vs making a comment, then click edit to change the status.


texts:
I am doing complex calculation using computed field and trying to set form_set_error and  stop form submission, also filled values should be retained.

form_set_error($field_val, t('Validation failed'));

form_set_error() is showing message but form is also submitting without any break.

Also tried

drupal_set_message(t('Validation failed.'), 'error');

but no success.


texts: Geting values for multipart form elements using Twig

texts:
Whereever you are, I hope you're fairing well under the circumstances. To some of the hardest hit areas, we are thinking of you constantly.

Webform Advanced Elements

I am having difficulty retrieving submitted values from Drupal 8.8.4 Webform 5.9 multipart elements using Twig. Standard, single form field, values work fine, however elements such as Name and Advanced Address do not. Both of latter elements have multiple form fields (e.g. first, middle, last name; or street, city, country...) and may be dynamic (e.g. pick a country before completing address).

In my case, I am using the Attachment PDF and a custom Twig template to generate a PDF file attachment that is returned to the user, however I can see the same result using Twig in an e-mail, or the generated test e-mail preview.

Testing:

A simple text field works correctly:

Dated: {{ data.date }}
 (works)

Name and Advanced Address are blank:

{{ data.my_name }}
 (blank)

{{ data.my_address }}
 (blank)

Tokens Work, Sort Of

For what it's worth, the multipart values are available using tokens in the e-mail body, albeit I can't get portions of the values, which is the objective. What I mean by this is that an entire complete address will be returned, on multiple lines, but getting just the street name doesn't work (for me).

Using the examples above:

[webform_submission:values:my_name] (returns John Smith)

It also wasn't possible to retrieve just a street address:

[webform_submission:values:address] (returns stree, city, state/prov., country on mutiple lines)

I've really been stumped, and I'm surprised it is so hard to find the answer. Perhaps I'm not working the question correctly, this is more of a hobby project. Thank you for suggestions.


texts: Can't login using OpenId (core) and Google profile

texts:
I'm using the OpenId module (included in core v7) but can't link an OpenId to an existing account. Every time I try to add it an error occurs:

  Sorry, that is not a valid OpenID. Ensure you have spelled your ID
  correctly.

I'm trying to connect using a Google profile. The URL I'm trying is "https://profiles.google.com/x" (x => my id).

Has anybody succeeded in doing this?


texts: How to delete folder along with the files from database also?

texts: I want to delete selected folder along with all files inside that folder. I tried by using file_unmanaged_delete_recursive() It will delete folders and files but it is not removing database entry of files and not even it is making the Status of the file to Zero. So how can I achieve this?


texts:
I went to the ckeditor website made a custom build of an ckeditor with the plugins I want, then downloaded and extracted it to

sites/all/libraries/ckeditor

(I previously installed the libraries and ckeditor modules)

then I went to the global configurations settings for ckeditor

admin/config/content/ckeditor/editg

For the "> Path to CKEditor * " value I entered

%l/ckeditor

which sets the location of ckeditor to

/sites/all/libraries/ckeditor

and I set the " Path to the CKEditor plugins directory " value to

%l/ckeditor/plugins

which sets the location of the plugins to

/sites/all/libraries/ckeditor/plugins

I save the configuration and flush all caches.  But whenever I go to edit a piece of content there is NO editor and NO body field at all on the page.

I can re-enter the default url used to install ckeditor and the editor will appear on the page, but of course, without my plugins. I have no error messages.  Anyone have any idea why ckeditor can't find itself?

thanks


texts: Rewrite content of view field based on value

texts:
On a business review page, I have a views block which shows each individual review submitted for the business. In the review form available to the user, I am using integer fields to allow the user to select their choices and to store the submitted information in the database. For instance, if a user selected in their review that the staff was "Very Helpful," then a 5 is stored in the database. This allows me to show the average value on the main business page and change the output based on php (using computed field). However, because of the way that the data is stored, the view block displays a "5" in the field for Staff Helpfulness instead of "Very Helpful."

So, the topic of the question, how can I rewrite text in a view field based on its value (i.e. replace the displayed "5" with "very helpful")?


texts:
Is there a way to translate a menu link URI?

When I change it in one language (e.g. http://www.example.com), it is also changed in the other language, where I want a different domain (e.g. http://www.example.de).

Link title and description is working as expected.


texts: Variables unavailable in views field template

texts:
I'm overriding the default views-view-field.html.twig for a specific field in a view.

The template is named:

views-view-field--conference_overview--page_1--field_media_oembed_video.html.twig

Note: this field is using a custom Field Formatter (the render array output of which is coming through fine.)

What works:

The template is loaded for the correct field, only that field and only that view, all as intended.
{{ output }} can be displayed correctly.
I can embed style attributes in the template file without them being stripped out by the XSS Filter (a problem I've had with direct Field Formatter output using templates and render arrays - I'm trying to work around that here by using a views template to do the 'style' bit, but some of the content of that still requires my Field Formatter)

What doesn't:

The docblock refers to other available variables such as view,field and row

{{ view }} produces:

  Exception: Object of type Drupal\views\ViewExecutable cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter()

Fair enough, Twig can't print that, but if I use {{ kint(view) }} it doesn't seem to give me any output at all (page stops loading without errors etc.)

{{ kint(row) }} - runs out of RAM
{{ kint(row[field.title]) }} = NULL
{{ field.view_node }} nothing
{{ field.view_node.content }} nothing
{{ field.field_title }} nothing
{{ field.field_title.content }} nothing

... and other combinations (I've seen reference to 'fields' in other questions, and using bracket rather than dot syntax).

(I moved my field to after the others in the Views UI).

Any suggestions?


texts: Error 'Cannot redeclare ctools_menu_add_tab()' after migrating website

texts:
After our hosting provider has migrated our website to a new server this fatal error occurs when accessing the site:

  Fatal error: Cannot redeclare ctools_menu_add_tab() (previously
  declared in
  /www/htdocs/mysite/drupal/sites/all/modules/ctools/includes/menu.inc:42)
  in
  /www/htdocs/mysite/drupal/sites/all/modules/ckeditor/ctools/includes/menu.inc
  on line 49

Now the mother of all questions: How can I fix this? :(

We're using Drupal 6 and – although I haven't checked it yet – all files and databases should have been copied correctly by our hosting provider.


texts: Does using MongoDB for field storage limit functionality?

texts:
I am considering using MongoDB on a site for field storage, and not just moving cache, session, lots, etc., out of my SQL database.

The Field Storage API should make this seamless, assuming I am using the Drupal API for accessing data.  But, does this limit my site in any way.  In particular, I am wondering how Views will be affected.


texts: How can I configure the backend to get a comfortable image insert functionality with captions?

texts:
Since Drupal offers many different approaches to inserting images, I am a bit lost. I am looking for a configuration that allows editors to comfortably insert images with captions. My requirements are:

Works with WYSIWYG editors
One input form to upload the image and enter the caption
At most one more step in the workflow to position the image in the text
Ability to create blocks with several images side-by-side
Ideally, no code changes (inserting JavaScript or altering PHP) should be necessary in order to retain upgrade capabilities

It seems that many people are using a combination of the wysiwyg module with IMCE and the IMCE wysiwyg bridge. However, I don't see any support for image captions in that toolchain.

The other alternative is the Insert Image With Text module, which is still in beta and rarely discussed anywhere. As far as I understand, this method is not really practical because it limits users to one image per node (or would require several image fields in the respective content type).

Is there any combination of modules and content settings that can fulfil those requirements?


texts:
I'm working on a site with the Search API Solr module.

I notice that, in fulltext searches, the system gives results only for entire word. If I've a title like "Beautiful", if I search "eautiful" it doesn't find something.
Is there a way to solve this?


texts:
ajax['path']
Description: This is the Drupal menu path for a callback function
which will generate HTML and return the string of HTML to Drupal. The
result will replace the div specified in #ajax['wrapper']. This
property is infrequently used in Drupal 7 and higher, because it is
set automatically if using the #ajax['callback'] property.

However, I can't still why #ajax['path'] function offers more than #ajax['callback'].
When should I use which one?


texts: Recovering from a WSOD related to hierarchical select module

texts:
I was messing around with the hierarchical select module (trying to create an exposed filter that would use the hierarchical select interface) I got some strange AJAX related error and then tried to cancel out of what I was doing.  After doing so, when ever I try and edit this view I get the White Screen of Death. I went to MAMP server PHP log files and found this error:

  [02-Feb-2012 15:58:10] PHP Fatal error:  Call to undefined function _hierarchical_select_setup_js() in /Applications/MAMP/htdocs/sites/all/modules/custom/hierarchical_select/modules/hs_taxonomy_views_handler_filter_term_node_tid.inc on line 26

Since I can't get back to my view I don't seem to have any way to remove this broken exposed filter.  Any way out or did I just lose this whole view?


texts: Theoretical limits of CCK (Field API) unlimited Multi Value Field - 170 000 values

texts:
I plan to have a large multi value field, in my case a node reference field, around 170 000 values.

I guess on node view I can hide the field, and just put in a Views block so the node can be viewed. Editing the node manually will be impossible, as the multi value fields have no paging and Drupal would just load the entire 170 000 values onto the screen. Any tips on solving this?

What I plan on having this is a content type "list" and a content type "item". In the items I will load an dictionary word lists, and in the "list" content type I will group them in different lists. I could use taxonomy as well, but nodes have a better permission control.


texts: field slideshow module and image field caption

texts:
I want to use image field caption and  field slideshow.

How can I set the caption field as caption for my slideshow?

I tried to apply the update but it didn't work.


texts: How to use parent paragraph or field name in template_preprocess_file_link function?

texts:
We created custom theme suggestion for fields links using this code
function THEME_theme_suggestions_file_link_alter(array &$suggestions, array $variables) {
  $route = \Drupal::request()->attributes->get('_route');
  // Adds a template suggestion for all files displayed as links, except in node/add and edit forms
  if ( strpos($route, 'add') === FALSE && strpos($route, 'form') === FALSE ) {
    $custom_suggestions[] = 'file_link__button';
  }
}

This allows us to use template_preprocess_file_link() to add more attributes to the file (MIME, weight, description...) like this :
/**
 * Prepares variables to recreate link in file-link--button.html.twig
 * file name & uri, formatted type (with user friendly names) & weight
 *
 */
function THEME_preprocess_file_link__button(&$variables, $hook) {
  // Define user-friendly MIME types name
  $mimes_types_name = [
    'application/vnd.ms-excel' => 'Excel',
    'application/pdf'          => 'PDF',
    // ...
  ];
  $file = $variables['file'];
  $file_type = $file->getMimeType();
  $variables['file_type'] = $file_type;
  if (isset($mimes_types_name[$file_type])) {
    $variables['file_type_formatted'] = $mimes_types_name[$file_type];
  }
  // ...
}

However in none of those function we can access the field name or better its parent to make a dedicated Twig template depending on paragraph parent or field machine name.
In THEME_theme_suggestions_file_link_alter() we could targetthe node type (using the route) but we're using paragraphs and we can't access the parent paragraph.
Any suggestion to make more than one Twig template for template_preprocess_file_link() ?


texts:
i have this code:

/**
 * Defines a wrapper target around a paragraph bundle's target field.
 *
 * @FeedsTarget(
 *   id = "feeds_para_mapper_temp_target",
 *   field_types = {
 *     "entity_reference_revisions",
 *   },
 *   arguments = {
 *     "@entity.manager",
 *     "@entity_field.manager"
 *   }
 * )
 */
class TempTarget extends FieldTargetBase implements, ConfigurableTargetInterface,
{
  protected $entity_type_manager;
  protected $field_manager;
  public function __construct(array $conf, $id, array $def, EntityTypeManagerInterface $en_man, EntityFieldManagerInterface $f_man)
  {
    parent::__construct($conf, $id, $def);
    $this->entity_type_manager = $en_man;
    $this->field_manager = $f_man;
  }
  // Here is where i need the instance, and it's weird because it gets called
  // without instantiating this class:
  public function defaultConfiguration(){
    // This function create a form configuration and return it:
    $definition = $this->targetDefinition;
    $field = $definition->getFieldDefinition();
    $instance = $this->createTargetInstance($field,$this->feedType)
  }
  // Calls this plugin manager to get instance of another plugin
  public function createTargetInstance(FieldConfigInterface $field, FeedTypeInterface $feed_type){
    // This is where the test is failing:
    $manager = \Drupal::service('plugin.manager.feeds.target');
  }
}

what it does it calls a plugin manager in order to create instance definition,
whenever it gets tested i see this error:

\Drupal::$container is not initialized yet.

which i know is caused by calling to the service
i have tried this in the test file:

$container = new ContainerBuilder();
$manager = $this->prophesize('Drupal\feeds\Plugin\Type\FeedsPluginManager');
$container->set('plugin.manager.feeds.target', $manager);
\Drupal::setContainer($container);

Not working.
i tried as the answer suggested in the comment bellow to add implement ContainerInjectionInterface not working, and with ContainerFactoryPluginInterface as this article suggested, not working too, in both implementations the create() method is never get called
i tried to add this to he annotation:

 *   arguments = {
 *     "@entity.manager",
 *     "@entity_field.manager",
 *     "@plugin.manager.feeds.target"
 *   }

with this constructor:

public function __construct(array $$conf, $id, array $def, EntityTypeManagerInterface $en_m, EntityFieldManagerInterface $f_m, FeedsPluginManager $p_m)
  {
    $stop = null;
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entity_type_manager = $en_m;
    $this->field_manager = $f_m;
    $this->plugin_manager = $p_m;
  }

and it's working only if this class is instantiated, and as i said it's not when the defaultCongiguration() get called, i can go without the plugin manager at this stage but i really prefer if i can have it in this function.

Update:

The reason why implementing either ContainerInjectionInterface or ContainerFactoryPluginInterface didn't work is because i added my dependencies in the arguments, annotation and in the create() method too.


texts:
I've a csv with taxonomy terms, with tids.
I've to import, with a module, these terms in a new drupal installation, but if I try to set the tid programmatically, the module does not create the term. Instead, if I don't set the tid, the term is created with but with the autoincremental tid.
This code doesn't work:

$term = new stdClass();
$term->name = 'Test';
$term->vid = 3;
$term->tid = 10; // if I remove this line the term is created
taxonomy_term_save($term);

The doc says:
tid: (optional) The unique ID for the term being saved. If $term->tid is empty or omitted, a new term will be inserted.

Is there a way to set the tid programmatically?
Or is there a module that do this?


texts:
I'm curious if there is a module or a way to display a working copy of a Drupal website even when MySQL goes down. While obviously if MySQL goes down, it should be resolved, it would still be nice for the customer side and their audience to be able to use the website still.

Has anyone ever done something like this before? You wouldn't be able to login or make content changes of course. Is there a way using .htaccess or something that you could ping the site and if MySQL is down, redirect to a cloned site?


texts:
I had previously created a view which is a list of nodes of type 'Banner'. I have added an extra field to the content type, and I have attempted to add this to the view, which seems as if it works ie. adds to the fields list, and reflects the changes in the live preview.

But then the live page doesn't reflect the changes, ie. the new text fields dont show up and the fields aren't populated in the $row or $fields variables in the views-view-fields.... theme files when debugging.

Also, when I go back to edit the view the new added fields are not there, so it seems as though they haven't been inserted into the database.

Does anyone have any idea why this would be?


texts:
I have inherited a client site that has an extremely large database for no reason. There is a moderate amount of content and very little enabled modules. However, the database is too large for moving around easily and I want to clean it out.

I have cleared out the standard cache tables, syslog and accesslog.

Are there any other tables I can safely truncate in a standard Drupal site?


texts: Assigning new region in a display suite layout does not show contents placed inside newly created region

texts:
// rmch-content-2.tpl.php
<?php
/**
 * @file
 * Display Suite RMCH Two Column Header template.
 *
 * Available variables:
 *
 * Layout:
 * - $classes: String of classes that can be used to style this layout.
 * - $contextual_links: Renderable array of contextual links.
 * - $layout_wrapper: wrapper surrounding the layout.
 *
 * Regions:
 *
 * - $header: Rendered content for the "Header" region.
 * - $header_classes: String of classes that can be used to style the "Header" region.
 *
 * - $left: Rendered content for the "Left" region.
 * - $left_classes: String of classes that can be used to style the "Left" region.
 *
 * - $right: Rendered content for the "Right" region.
 * - $right_classes: String of classes that can be used to style the "Right" region.
 */
?>
<<?php print $layout_wrapper; print $layout_attributes; ?> class="<?php print $classes;?> clearfix">

  <?php if (isset($title_suffix['contextual_links'])): ?>
    <?php print render($title_suffix['contextual_links']); ?>
  <?php endif; ?>

      <<?php print $content_left_wrapper; ?> class="ds-content-left <?php print $content_left_classes; ?>">
        <?php print $content_left; ?>
      </<?php print $content_left_wrapper; ?>>

      <<?php print $content_right_wrapper; ?> class="ds-content-right <?php print $content_right_classes; ?>">
        <?php print $content_right; ?>
      </<?php print $content_right_wrapper; ?>>

   <<?php print $content_right_wrapper; ?> class="ds-content-footer <?php print $content_footer_classes; ?>">
        <?php print $content_footer; ?>
   </<?php print $content_right_wrapper; ?>>

      <?php print render(block_get_blocks_by_region('page_links')); ?>

</<?php print $layout_wrapper ?>>

<?php if (!empty($drupal_render_children)): ?>
  <?php print $drupal_render_children ?>
<?php endif; ?>

So I have added new footer region in the .inc for the layout
    rmch_content_2.inc

/**
 * @file
 * Display Suite RMCH Header 2 col, Content 2 col
 */

function ds_rmch_content_2() {
  return array(
    'label' => t('RMCH Content 2 col'),
    'regions' => array(
      'content_left' => t('Content Left'),
      'content_right' => t('Content Right'),
      'footer' => t('Footer'),
    ),
    // Uncomment if you want to include a CSS file for this layout (rmch_two_column_header.css)
    'css' => FALSE,
    // Uncomment if you want to include a preview for this layout (rmch_two_column_header.png)
    'image' => TRUE,
  );
}

I have added new region footer which is visible in the screenshot and added Links field inside Footer
When I add Links field in the Content Left , it displays links but when I add  it in the footer it does not show up and the variable
print $content_footer; inside tpl.php file turns out to be empty completely.
What should I do the make sure blocks or fields added inside newly created regions show up.?


texts: Published-Draft articles are not searchable

texts:
I am using Drupal 8.3.x and Search API 8.x-1.5.

I am new to Drupal and Search API. I have a clarification on Search functionality.

I have created a article where Title and Body fields are indexed. I have published the article.

When I search for the keyword of Title or Body, article found in search results.

After that I modified the article and saved as draft.

When I am trying search the article with modified text. The article is not returning in the search results.

Can someone please let me know, if this a known issue with the search or it is the expected behaviour? If yes, any specific reason for implementing like this?


texts:
I m not using Drupal 7 with its default way. I don't publish in front page, since I use a view for the front page.
I produce an RSS feed from a view.

How I can make the RSS icons appear at browsers' address bar?


texts: Pre fill multiple paragraphs while adding node

texts: I want to prefill multiple paragraphs when user click on "add node" for specific content type. What would be a good way to do this ?


texts: I just need an array of the preset names, is there a simple way to do this?


texts: Display images twice in a node with different image cache settings

texts:
I have a node type where I'd like to display images as both thumbnails and full size images, so I'd like to use different image cache settings on the two image types. I don't want to use views to do this. I know that I can output a field twice using "print render($content['field_name']); " in my node.tpl file, however I wouldn't be able to manage the display separately on the two outputs.

Does anyone have a solution?


texts: Users who just registered can login & change profile information, but cannot create certain contents until admin lets them

texts:
Users who just registered can login & change profile information, but cannot create certain contents until an admin says they can. I know this can't be achieved using the Drupal Approved/Not arppoved scheme. Are there alternatives? Maybe with permissions?

If possible, I would also like to use a block(or other means) to let the logged in user of their status/permissions e.g. they can only change profile info, cannot create certain contents, etc.


texts: How to add a conditional billing field based in Country in "Commerce Kickstart"?

texts:
I added a new billing mandatory field called "NIN Number" at admin/commerce/customer-profiles/types/billing/fields

But I only need to show this new field only if the selected country is United Kingdom

How can I do this?

Will the https://drupal.org/project/conditional_fields module be usefull to get it?


texts:
Using Drupal 8 and trying to get the contact form to redirect to the same page after submitting. By default it seem to redirect to the home page.

I have edited my themename.theme file

function themename_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  //contact page form
  if ($form_id == 'contact_message_feedback_form') {
    $url = Url::fromRoute('contact.site_page');
    $form_state->setRedirectUrl($url);
  }
}

This throws a bunch of mysql errors. Like so:

Uncaught exception thrown in session handler.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than 'max_allowed_packet' bytes: UPDATE {sessions} SET uid=:db_update_placeholder_0, hostname=:db_update_placeholder_1, session=:db_update_placeholder_2, timestamp=:db_update_placeholder_3 WHERE ( (sid = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => 1 [:db_update_placeholder_1] => ::1 [:db_update_placeholder_2] => _sf2_attributes|a:1:{s:3:"uid";s:1:"1";}_sf2_flashes|a:0:{}_sf2_meta|a:4:{s:1:"u";i:1454074283;s:1:"c";i:1452243053;s:1:"l";s:7:"2000000";s:1:"s";s:43:"dVseXv540u6wL5GZm_gs6fzuP9qtck-j5A5lexqnaQE";}authorize_page_title|O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:14:"Update manager";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}messages|a:1:{s:6:"status";a:2:{i:0;O:25:"Drupal\Core\Render\Markup":1:{s:9:"*string";s:1020035:"<script class="-kint-js">(function(){if("undefined"===typeof kintInitialized){kintInitialized=1;var e=[],f=-1,g=function(b){var a=window in Drupal\Core\Session\SessionHandler->write() (line 89 of /Users/timmcdonald/Code/waypoint/v3/core/lib/Drupal/Core/Session/SessionHandler.php).

and other errors.
Is there something I am missing?


texts:
I have installed the EntityPrint module in drupal 8 for the pdf conversion.

Followed below procedure:

  curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer composer config repositories.drupal composer https://packages.drupal.org/8

  Run: composer require "drupal/entity_print 2.x" in the site docroot/.

https://packagist.org/packages/mikehaertl/phpwkhtmltopdf
https://packagist.org/packages/dompdf/dompdf
https://packagist.org/packages/tecnickcom/tcpdf

I have installed the above packages using, as the entity print module insisted to install it in drupal page.

Once the installation was done, drupal site was crashed, while checking the error log, I got the following:

  [error] FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'Drupal\Core\DrupalKernel' not found in /var/www/html/drupal/index.php on line 16" while reading response header from upstream

I have uninstalled the packages but unable to disable entity print. Since my drush command results in error.

Can anyone please help me to find out?


texts: What are functions that start with 'hook' used for?

texts:
I understand how to use hooks (mymodule_HOOKNAME()) but what are functions used for that actually start with hook?
Ex: hook_action_info()

When I am creating custom hooks I normally just use: module_invoke('MODULE', 'HOOK_NAME').


texts: So I get the following error "the program can't start because cygintl-2.dll is missing from your computer. try re installing the program to fix this problem" I am getting this error when I try to run a ls command. I have re installed like the pop up suggests. I used the windows installer to install this.


texts: Prevent "AJAX HTTP request terminated" error on early form submit

texts:
I'm doing an ajax validation for duplicate check on link field in node form. When the link field is edited, an ajax call is triggered as programmed (using form api #ajax default blur event), it  takes a while for the ajax response to reach browser, in the meantime the form gets almost ready to submit by user. Doing an early form submit (i.e before the receipt of ajax response) Drupal ajax API throws below error message in JavaScript alert box,

An AJAX HTTP request terminated unexpectedly
Debug information follows.
Path: /system/ajax
Status text:
Answer Text:
Ready State: 4

I have noticed this issue in a few contrib modules as well. I think the fix is to prevent submitting the form to server until the ajax request completes. Wondering to know if there is any way to set client side callback function in form api that I can use to stop form submit.


texts:
My company website has several physical locations / branches that need to be referenced all throughout the website on basic pages.

I would like to create one central table with one instance of each location so that when details change for that location I can make that one change and it will dynamically update all instances of that location across the site.

I could create a block for each location and reference that block where applicable, but the location content needs to go within the actual body of the pages and not in a block region. Is this possible?


texts: naming convention for .tpl.php in drupal 7 for custom content type

texts:
I have created content type named basepage and have created content test
My page url is

  ?q=basepage/test

what should my .tpl.php page name
like (node--1.tpl.php)


texts: Why aren't CSS files served? There is nothing in sites/default/files/css

texts:
In my Drupal 8 installation profile, I install a theme and a lot of configuration for it.  I'm using Features to install blocks/settings/views for it, but when I enable the feature Drupal stops serving ANY CSS files on page loads.

I don't think it's an issue with features, because if I wait long enough, those files will be generated by Drupal and CSS files will load as normal, it's just that Drupal assumes those files already exist.

I have tried:
- drush cr
- clearing the cache manually in the UI
- all of the individual drush cc options
- deleting the contents of all cache_* tables and clearing the cache or drush cr
- turning aggregated css off, clearing caches, turning it back on, clearing caches
- running cron
- running /update.php

...Is there any way I can tell Drupal to generate these files instead of waiting hours for it?


texts: Is it possible to use ctools modal for showing modal upon modal(multiple modals)

texts: I need to show node full view in modal and again in full view there is one form to be shown in modal.


texts: How to use a tpl.php file for a theme function

texts:
I am using LoginToboggan which provides a theme function. You can use this theme function in a template.php file to control the mark up.

However, the code becomes quite unwieldy in template.php. Is there any way to modify the function so it can use a tpl.php file?

More info

This is the function LoginToboggan provides:

function theme_lt_unified_login_page($variables) {

  $login_form = $variables['login_form'];
  $register_form = $variables['register_form'];
  $active_form = $variables['active_form'];
  $output = '';

  $output .= '
';

  // Create the initial message and links that people can click on.
  $output .= '
' . t('You are not logged in.') . '
';
  $output .= '
';
  $output .= l(t('I have an account'), 'user/login', array('attributes' => array('class' => array('login-link'), 'id' => 'login-link')));
  $output .= ' ';
  $output .= l(t('I want to create an account'), 'user/register', array('attributes' => array('class' => array('login-link'), 'id' => 'register-link')));

  $output .= '
';

  // Add the login and registration forms in.
  $output .= '
' . $login_form . '
';
  $output .= '
' . $register_form . '
';

  $output .= '
';

  return $output;
}


texts:
I have a view that shows all the articles then I can select the year. I made this with a group filter.
At this point drupal send the user to an url /noticias?created=2

and here news of 2014 are displayed

and so on..
noticias?created=3 ---> 2013
noticias?created=4 ---> 2012
...

Now I want add a link in the main menu

News 2014 (path: noticias?created=2)

but it says: The path 'noticias' is either invalid or you do not have access to it.

The question is

How can I create a menu link for each year? I would not like to use absolute path...

Thanks


texts:
I'd like to change the date format that is used for articles in Drupal 8. It looks like it uses the Default medium date format by default. I added my own format at admin/config/regional/date-time, but I  can't find where to edit the format that articles use.

Is there a way to do this from the CMS or does this need to be done in code?


texts:
Versions:
->Drupal 7.10
->LDAP Authentication/Authorization/Servers/Query/Views 7.x-1.0-beta5
->Views/Views UI 7.x-3.3

I'm attempting to configure a View via the Views UI module to support a custom LDAP query defined in the LDAP Query module. The example they provide depends on the existence of a query with the machine name of "ad_users", and does function when I define a query with that name, but there doesn't seem to be a way to alter this or point a view toward an arbitrary query.

I'm wondering if I'm overlooking something. It seems illogical that the Views plugin wouldn't let one point a View toward an arbitrary LDAP Query. The question is how to do this?


texts: How can I place content in page_top in D7 since it is hidden in regions?

texts: I need to place a small menu in the page_top region using D7. I know the region is hidden, so my thought is to create a completely new region in the place that page_top would be showing up (I'm not sure how this is done). I have been creating a subtheme using Zen. Does anyone have an idea about how I can do this? Help is sincerely appreciated.


texts: How can I display the Google rich snippets when a view is on "Show: fields" and the panel enabled?

texts:
I am building a site using Drupal 7 and the schema.org module and the microdata module.
The site is live on production server (and works good).
When checking a url from my site site on the google rich snippets tool, I can't see all the fields I want to appear in the snippets.
When using panels, views, microdata module and schema.org module -
the snippets does not work.
When I deactivated the microdata module, and disabled the specific panel on the page the snippets work! So, I decided to disabled the microdata module, and work only with the schema.org module.
With the the schema.org modules:

When views is on "show: content" and the panel Enabled - snippets work!

When views is on "show: fields" and the panel Disabled - snippets work!

When views is on "show: fields" and the panel Enabled - snippets do NOT work!
Can I use the Rewrite option on a view to add some code to fields and make it work?
How can I display the Google rich snippets when a view is on Show: fields and the panel enabled?


texts: How to execute ajax action after image file upload with media widget?

texts:
I want to prepopulate some node fields with image metadata (using the EXIF module) right after an image is uploaded/inserted in a node image field with media browser widget and before the node is being saved.

By default, the EXIF module updates the node fields with image metadata after the node is being saved. But, ideally, I would like to hook into the file upload process and update the node fields instantly with ajax, so that users can preview and even edit the metadata related fields.


texts: Theme CSS libraries always loaded after module libraries

texts:
My custom theme uses Bootstrap, which I'd obviously like to load before any module CSS libraries, but Drupal ignores any kind of ordering for themes, and Bootstrap CSS styles appear as @import in a <style> tag that always comes last, even if it's set to base.  Modules however, respect SMAACS groupings and will move CSS @imports into different style tags.

How can I get the theme CSS files to load before module CSS files?  Why is bootstrap ALWAYS at the bottom?

I've cleared the cache, disabled devel, tried aggregation on and off. Nothing makes a difference.

This is the code I am using.

/themes/custom/trent/trent.info.yml

core: 8.x
type: theme

name: "Trent"
description: "Test theme"
package: "Trent"

libraries:
  - trent/bootstrap

/themes/custom/trent/trent.libraries.yml

bootstrap:
  css:
    base:
      libraries/bootstrap/bootstrap.min.css: {}

/modules/custom/trent_news/trent_news.info.yml

name: Trent News
type: module
description: Displays news
core: 8.x
package: Trent
libraries:
  - trent_news/trent-news

/modules/custom/trent_news/trent_news.libraries.yml

trent-news:
  version: 1.x
  css:
    theme:
      css/trent_news.css: {}
      css/print.css: {}

I want bootstrap to move up higher but Drupal isn't respecting any setting; it just keeps it in that last <style> tag no matter what.  However, it does respect SMAACS ordering within that style tag, oddly enough. As I mentioned, I can change the module ordering (e.g. theme -> component) and the CSS imports will move into different <style> tags accordingly.

UPDATE:

core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php:165 overrides and ignores any SMACCS setting (or group setting in *.libraries.yml) for theme CSS.  It actually doesn't appear possible to move the import higher up before any module includes:

$options['group'] = $extension_type == 'theme' ? CSS_AGGREGATE_THEME : CSS_AGGREGATE_DEFAULT;


texts:
I have a calendar view in my Drupal 7 website, that looks like this:

And I also have a date field in a Webform:

All of these appear in english, of course. But, I want to translate all dates to portuguese.

How can I do that easily?

Thanks a lot.


texts:
I am running Drupal 8.5.5 and am running into a problem. It seems for anonymous users jQuery is not loading a library that it would when I am logged in as admin. I tried to understand why that is but I am stumped. So far I disabled js caching, I have the following in my libraries.yml:

leadership:
   version: 1.x
   css:
     theme:
        css/leadership.css: {}
   js:
      js/leadership.js: {}
   dependencies:
      - core/jquery: {}

and it loads on the page, and runs this javascript which calls:

$content.toggleClass("whole-body", 800);

In the admin, I see the transitional effect of 800 seconds, but anonymous users don't see that.


texts: Change the output of block view - better than using mymodule_block_view_alter

texts: I needed to low-level customize the output of a View, with PHP. I have been playing around with hook_block_view_alter, with hook_views_pre_render, but the problem is that the exact field I was looking for did not appear in the last function and in block_view_alter I only had access to the content[#markup], which is the un-structured content. Is there some other function that I can use so I can have access to all content as in block_view_alter but only to change the value of a given field?


texts: How can I log in as any given user with Drush?

texts: How do you login to a Drupal site if you do not have the password of the admin user or user 1 but still have access to the command line? Can I use Drush to log in to the Drupal site?


texts:
I have installed mysqlnd when I try to use the drush command drush cc all, I get the following message.

  No Drupal site found, only 'drush' cache was cleared.

and when I run the command drush ws I get the following message.

  PHP Fatal error:  Call to undefined function module_exists() in phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc on line 187
  Drush command terminated abnormally due to an unrecoverable error.
  [error]
  Error: Call to undefined function module_exists() in
  phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc, line 187

If I try to run the above commands without the mysqlnd plugin, they work fine.

Also, if I run drush status I get the following:

 Drupal version         :  7.43
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  myapp
 Database port          :
 Database username      :  drupal
 Database name          :  web1
 PHP configuration      :  /etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /usr/local/bin/drush
 Drush version          :  8.1.3
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :  /root/.drush/aliases.drushrc.php
 Drupal root            :  /var/www/html/site2
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default

The above won't show the theme name. Also if I try to run drush mysql-cli I get the following message:

  ERROR 2005 (HY000): Unknown MySQL server host 'myapp' (0)

I wonder if I can get the above commands running using the mysqlnd plugin.


texts:
I'm using Entity Translation and I've enabled "Enabled, with field translation" in a content type but don't want to translate each individual field.

It seems "Field translation" of i18n suit does it and in translate interface at admin/config/regional/translate/translate we can translate the field labels.

But the problem (as in the photo) is that it shows the same field text for all the content types sharing same field with same label. That is for same label I should be able to translate once only.

Is there any more simple way to translate field labels at once?

A similar question is here:  How to translate Boolean field labels? but seems to be more specific.


texts: AJAXifying content and pagination problems

texts:
I am using the Ajax links API module that allows to load a node inside a
 tag by using Add page.

However, I have a problem: If I use a pager, and I click on the link to see another page, I will be redirected to that page, instead of loading it inside the
 tag.

I solved partially by using the Views Infinite Scroll module, but if I have several
 tags, the module doesn't load the correct view in the correct
.

It seems I cannot use the pagination because the URL is not re-written to accommodate to the container, and it is not scrolling because this limitation.

Is there some way of creating simple AJAX calls loading content in different
 tags on the same page, and with pagination (or load more button, infinite scrolling, etc.)?


texts: How do I create a View to use Bootstrap Paragraph fields and group by the title?

texts:
I have a View for FAQ's, and an exposed combined fields filter. I created an FAQ content type, and added a paragraph field that contains "Question" and "Answer" fields. I cant use Search API, and want to find a way for this to work with Views.

If I choose to make a page of fields, the paragraph fields don't work in the combined field search.

If I choose to do a page of paragraph fields, I cant add the title field.

Any help is appreciated!


texts:
We're trying to create our very first theme in drupal 8 and we're having some problems with it.

When we try to link our custom css and try to load the page it gives us

  The website encountered an unexpected error. Please try again later.

We've tried different solutions, but none of them worked and we're kinda lost.

here's our Fubiz_NJ.info.yml file

name: Fubiz_NJ
description: Website homepage reproduction
type: theme
core: 8.x
libraries:
  - Fubiz_NJ/global-styling
  - Fubiz_NJ/global-scripts
stylesheets-remove:
  - core/assets/vendor/normalize-css/normalize.css
  - core/modules/system/css/system.module.css
  - core/modules/system/css/system.theme.css
  - core/modules/views/css/views.module.css

# Define regions
regions:
  header: 'Header'
  primary_menu: 'Primary Menu'
  secondary_menu: 'Secondary Menu'
  slideshow: Slideshow
  page_top: 'Page Top'
  content: 'Main content'
  footer: 'Footer'

and here's our Fubiz_NJ.Libraries.yml file

global-styling:
    version: 1.0
        css:
            theme:
                css/style.css: {}

global-scripts:
    version: 1.0
        js:
            js/script.js: {}

We're both new to drupal so we don't really know where to look at this point, Hope you guys can help!


texts: Possible to turn off Twig debug mode for a specific template?

texts:
I have overridden a Twig template for an image field, which uses Image URL Formatter in order to remove the surrounding Div's.

Here is my Twig template for the field (field--media--field-image--image.twig.html):

{% for item in items %}
    {{ item.content }}
    {% if loop.length > 1 and not loop.last  %}
        {{ ', ' }}
    {% endif %}
{% endfor %}

The field is output to the src tag in the Twig template for my Media Bundle (media--image.twig.html):

    {% if href is not empty %}

    {% endif %}

    {% if href is not empty %}

    {% endif %}

However, the twig debug information outputs as part of the image URL:

Is there any way to turn off twig debug for a specific template?  Or any other way around this?


texts: How to exclude the result of one view from another one?

texts:
I would like to implement a discussion overview page which displays the hot topics  and latest topics, excluding the hot topics from the latest ones.

I have two displays in the same view, each of those operates on the same dataset (listing the same content type).
The difference between the two displays is the sort criteria only.

Is it possible to set up the display which generates the latest topics list to exclude hot topics? More generally: is it possible to exclude the results of one view from another without making a custom module?

I would like to get a general answer not involving offsets, because we'll probably face a situation where the sort criterias have to change. Most likely offsetting won't solve my issue there.

[Drupal 7 with Views 3.]


texts:
How can I change the page title output?

<title>{{ head_title|safe_join(' | ') }}</title>

in html.html.twig changes the mark/letter which creates: <pagetitle> | <sitename>, but I want to change this order to <sitename> | <pagetitle>


texts: Can I make a subdirectory in public:// viewable in Media module's UI?

texts:
In Drupal 7 Media module (admin/content/media) is it possible to view subdirectories in my public:// domain? I have images and files from legacy site that were uploaded in a variety of subdirectories, i.e.

sites/default/files/presentations

sites/default/files/sponsors

etc.

My Media module browser lists all the files that exist in the main public:// directory, but doesn't show any of the subdirectories, even though I confirmed via FTP the subdirectories exist. Thanks!


texts:
How can I remove the < from the breadcrumb I tried implode('<', $value['data']) but no luck

   function bootstrap_fit_breadcrumb($variables) {
            $breadcrumb = $variables['breadcrumb'];

            if (!empty($breadcrumb)) {
              //$breadcrumb[] = drupal_get_title();
              $breadcrumbs = '
';

              $count = count($breadcrumb) - 1;

              foreach ($breadcrumb as $key => $value) {
                  if ($key==0) {
                    $breadcrumbs .= '
' . $value . '
';
                  } else {
                   $breadcrumbs .= '
' . $value['data'] . '
';

                  }
              }
              $breadcrumbs .= '
';
              return $breadcrumbs;
      }
   }

displaying

Home < Financial Services


texts: Create a views block which shows terms from a specific taxonomy vocabulary added to the node

texts: If you have a taxonomy called "How to get there" and a restaurant node. When you edit that restaurant node you can select what travel methods you can arrive at that restaurant using. We want to surface this information on the node which is very easily done using display but the taxonomy terms don't have CSS classes for us to target to turn into an icon. I thought of doing this by creating a views block? Or is there a simpler way to render the taxonomy terms on the node with css classes for each one for example this is how it looks now:


texts:
I'm using the Entity API in my module and I'm starting to feel headache with so many problems.

If you think this is a duplicate of this one or this other you are wrong, just keep reading

I need an Entity to represent a work centre of an organization, this is the simplest case possible since I only need one field, the centre’s name (and obviously on the database table I will need an ID).

Well, I already passed trough the problems described on the questions linked in the previous paragraph, but it was not enough.

I specified the setter callback for the centre's name, I even specified the schema field on which relies the property. I used my own setter and with the dpm() function provided by the Devel module I discovered that the object's instance seems immutable, I tried to update the value but didn't worked, probably I could get rid of the entity class and use the metadata wrapper for updating the values, but that could have side effects.


texts: how to display the last mailchimp campaign?

texts: I need to display the last campaign (preview, description, name) in my website but currently mailchimp module doesn't have a block or view to do this, is there another alternative?


texts: How to get a second join into hook_views_data?

texts:
I am trying to make the value of a string (name) found in mymodule_names.name available to Views by means of hook_views_data().

To get the name, I need to first look up the nid of the node I want to view in a table named mymodule.  This tells me the email-address of user who authored the node.  Then I need to look up the email address in the table mymodule_names, by finding the row where the same email address is in the column mymodule_names.email. What I want returned is the user name attached to that email-address, which  the value of mymodule_names.name in the same row.

The code below is how far I have been able to get. This makes the value of mymodule_names.email available - but getting that is just an intermediary step.  I think I need a second join to get the user name. I am unable to figure out how to do do that.  How should I modify this code to get the data from the second table?

/**
 * Implements hook_views_data().
 */
function mymodule_views_data() {
  $data = array();
  $data['mymodule']['table']['group'] = t('MyModule');
  $data['mymodule']['table']['base'] = array(
    // This is the identifier field for the view.
    'field' => 'nid',
    'title' => t('MyModule'),
    'help' => t('Table contains ...'),
    'weight' => -10,
  );

  // This table references the {node} table. The declaration below creates an
  // 'implicit' relationship to the node table, so that when 'node' is the base
  // table, the fields are automatically available.
  $data['mymodule']['table']['join'] = array(
    'node' => array(
      // Primary key
      'left_field' => 'nid',
      // Foreign key
      'field' => 'nid',
    ),
  );
  $data['mymodule']['nid'] = array(
  'title' => t('Title'),
    'help' => t('Help.'),
  );
  // Join with the email field.
  $data['mymodule']['email'] = array(
    'title' => t('Email'),
    'help' => t('Author email.'),
    'field' => array(
      'handler' => 'views_handler_field',
      // This is used by the table display plugin.
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  return $data;
}

(This is a non-standard setup where node.uid cannot be used to get the node author UID.)

I know how to get the name by inserting a subquery with hook_views_query_alter() (see: this answer). The question is about doing without using subquery.


texts: How to display an "Out of Page" (PopUp) ad from Google DFP on a Drupal 6 site?

texts:
Been beating my head on this for a while now. We've recently set up Google DFP for small publishers to use with a Drupal 6 site. We use the google admanager module to display the ads properly throughout the site using blocks.

I'm trying to create an out-of-page (ie. popup) for the front page.

In the past with OpenX I accomplished this by putting popup code in a block on the page. But this hasn't seemed to work yet with DFP.

Admittedly I'm still learning the in's and out's of the system, but have tried a few different ways now to no effect.

I've tried this: https://support.google.com/dfp_sb/answer/3370474?hl=en but haven't gotten it working yet, and not sure it will even be suitable for general use by staff who submit ads.

Would love to hear how others are making this work.


texts: WYSIWYG+CKEditor outputting span with style attribute

texts:
I have a strange behaviour on the text editor on my D7 site.
I am using WYSIWYG-7.x-2.1 module with CKEditor v.3.6.3.7474.
If I type:

test
test
test

on the editor then Disable rich-text I can see:

test

test

test

Which is correct. Now if I Enable rich-text and then put my cursor at end of line 1 then press delete, it makes the 2nd line join the end of the first line:

testtest
test

Then I press Return again to separate those lines:

test
test
test

Now if I Disable rich-text I get:

test

test

test

As you can see it has created a span tag with line-height css.
It not only does this for paragraphs, it also changes heading tags, like H2 will get changed to a span with style attributes that duplicates the display of h2 but it's a span inside a paragraph tag...
A lot of different developers have worked on this website, but I can't reach them to ask what they did, they probably won't remember anyway.
So I'm asking if anyone else has had this issue and could point me in the right direction. Is it CKEditor config? WYSIWYG config? Drupal config? Version bug? Tried to search Google but don't get much relevant results.


texts: D7 - when I change a display suite display mode, shouldn't views using that display mode also change?

texts: I made a change to a display suite display mode, hoping that it would change a view that uses that display mode.  It did work while logged in, but as soon as I logged out it didn't work.  Yep, I did flush cache, multiple times.


texts: Page body content updated only after second load

texts:
I want to programmatically update the HTML contents of a page (a node of bundle type 'page') on my Drupal 7 site, by doing the following:

function my_page_generate() {
   // Find and load the page I want to update (can't do it by nid since
   // it might differ)
   $query = new EntityFieldQuery();
   $entities = $query->entityCondition('entity_type', 'node')
   ->propertyCondition('type', 'page')
   ->propertyCondition('title', 'Last News')
   ->propertyCondition('status', 1)
   ->execute();
   $node_key = array_keys($entities['node']);
   $node = node_load($node_key[0]);

   //Update its HTML contents
   $node->body[LANGUAGE_NONE][0]['format'] = 'full_html';
   $node->body[LANGUAGE_NONE][0]['value'] = '<h1> BREAKING NEWS </h1>';

   node_save($node);

   return node_view($node, 'full');
}

This method is called when requesting a URL by using the hook_menu hook, like this:

function my_module_menu() {
   $items = array();
   $items['last-news'] = array(
    'title' => 'Last News',
    'page callback' => 'my_page_generate',
    'menu_name' => 'main-menu',
   );

   return $items;
}

However, when I navigate to /last-news on my site, the old contents of the page are displayed. If then I reload the same page again (using the same path), the new contents I created show up. I have tried to disable the page cache for this page by calling $GLOBALS['conf']['cache'] = FALSE, but it keeps showing the same behavior.

Any ideas how to solve this?


texts: Block visibility role section is missing

texts:
I am doing development in drupal 8. All of a sudden, I see that block visibility role section is missing.

How can I bring the block visibility role section back?


texts: Using wildcards in custom module outputting sql query

texts:
It has become obvious to me that SQL syntax is a little different within drupal.

After some fiddling around I am getting the hang of it, but I haven't been able to use wildcards succesfully.

$sql = 'SELECT name Nombre, mail Email  FROM users WHERE status = 1 AND mail LIKE ('%@hotmail%') LIMIT 25';

Do you have any suggestion? I haven't been able to find (or I might be looking in the wrong places) for Drupal documentation regarding wildcards within $page_content in a module.


texts:
I want to create a completely bespoke admin page for some custom functionality. I don't want to hack the concept into render arrays as it will get messy fast.

I've got a menu declaration with a callback function, in here I can include and render templates. Using buffer streams, however, this only renders the file i'm passing.

Is it possible and if so how, to extend Drupal's default admin layout (header/footer/scripts/css) and print my 'template' in where $page would normally go?

I know I could view source and copy the code required, but I feel that would be an awful approach so please don't suggest.

Attempted solution not working.

function MYMODULENAME_menu() {
    $items = array (
        'admin/content/xxx' => array(
            'title' => 'xxx',
            'page callback' => 'MYMODULENAME_timetable_admin',
            'access arguments' => array('access content'),
        )
    );

    return $items;
}

function xxx_theme() {
  return array(
    'funky_admin_page_content' => array(
      'variables' => array(),
    ),
  );
}

function xxx_funky_admin_page_content() {
    echo "hello world";
  return 'hello world';
}

function MYMODULENAME_timetable_admin() {
  return array(
    '#theme' => 'xxx',
  );
}

Hello world isn't found in view-source. So I can only gather that the function isn't firing. I've cleared caches several times. Am I missing something obvious?


texts: Can I suppress PHP error messages for authenticated users, BUT display all of them for an admin?

texts:
I would like to suppress all the PHP error messages (errors, notices) for a regular authenticated user, BUT display ALL of them for an administrator ($user->uid == 1 or user with an "administrator" role).

This way I have the opportunity to set "Error messages to display" to "None" at admin/config/development/logging, but unfortunately this is a GLOBAL setting, which is not the right one for me.


texts: Rules "After a new content is saved" interferring with hook_node_insert?

texts:
I have a Rules triggering after new content is saved, and in a custom module a hook_node_insert function.

It seems that when one is activated the other one is disactivated... Is it normal behaviour ?

Thanks.


texts:
When a user logs in, I'd like him to see his profile info (name, address) with a link to a form to edit that info.
I thought this should be a trivial task, because it is something needed on almost every site that allows users to register. Yet, I failed to get anywhere after a couple of hours of trying and searching.

What I have now is a view (using the views module) that displays a list of all users where each one has a link to the edit page. But I only want a user to see and edit his own stuff ...


texts: Select content nodes and pass the selected ones to a controller of a custom module

texts:
I am developing a module and I have cloned the content view (/ admin / content /) that comes by default in drupal 8, what I need is to select each one of the nodes (checkboxes) and execute an event with a button.

So far, in the .routing.yml file of my module I have added and I can see the view that shows all the contents, but it comes with the action combo and a button to apply the action to the selected elements.

How can I just show a button that has another text and that at the moment of clicking, I pass the selected nodes to a controller that has another route configured?

Thanks.


texts: How to use Views & Entity Reference to create dynamic URLs that are based title from the referenced node

texts:
Here's my situation:

I have two content types: Procedure, and Testimonial. Testimonial has an entity reference field where you can point to one or more procedures.

My goal is to create a view of testimonials with a dynamic URL like 'example.com/testimonials/procedure1', where procedure1 is the title of the node that is referenced from the testimonial. So, the idea is that this page would exclusively show testimonials that reference the procedure1 node.

So, I created the view. I added a relationship "Entity Reference: Referenced Entity". I then created a contextual filter that uses this relationship.

At this point, if I do not use a relationship in the contextual filter, I can get this working by using the following pattern: example.com/testimonials/7, where 7 is procedure1's node ID. But, I'd like to use the title in the URL- not the node ID.

Does anyone know where to go from here?  Am I going about this the wrong way?

Thank you!