texts:
I have a simple master-detail use-case with Customer as a master entity, and Estimate, a detail entity. In Estimate, I've created an Entity-Reference field called "Customer Name" that refers to the same column in the Customer entity.

But in Estimate entity, when I try to assign a widget type of "Inline entity form - Single value" to Customer Name, it threw the below error :-((

My objective is to provide an inline form so that user can add/edit customers while he is in the Estimate form itself. Please help.

Notice: Undefined property: stdClass::$nid in entity_metadata_no_hook_node_access() (line 619 of /home/prahlad/source/php/drupal7/sites/all/modules/contrib/entity/modules/callbacks.inc).
Notice: Undefined property: stdClass::$vid in entity_metadata_no_hook_node_access() (line 620 of /home/prahlad/source/php/drupal7/sites/all/modules/contrib/entity/modules/callbacks.inc).
Notice: Trying to get property of non-object in entity_metadata_no_hook_node_access() (line 620 of /home/prahlad/source/php/drupal7/sites/all/modules/contrib/entity/modules/callbacks.inc).
Notice: Undefined property: stdClass::$nid in node_access() (line 2999 of /home/prahlad/source/php/drupal7/modules/node/node.module).


texts:
I like to create a table where the first column is the category (what is in a dictionary) and the next 4 columns are some products from this category. Here is an example: http://www.numark.com/categories

How can I create it it?


texts: How to change drupal commerce views like checkout,payment?

texts:
i configured drupal commerce module all working fine.question is how to format or design the checkout page,billing page,review page,payment page. i can add more data but how change existing data..i make tpl file for related name but by this we can add more data but how to change existing data plz tell me ASAP.

in detail:actually drupal commerce provides four page for checkout (1)checkout(2)billing address(3)order review(4)payment all are working fine problem is: can i change the all four page's design and add more data to it.how can i find out the html of these four page. i can't figure out by making template file of those four page.


texts: How to Enter Fields in the Order Information form (and confirmation email)?

texts:
I need to add additional fields in the customer's information form during checkout, such as Telephone number and "How did you hear about us?".  I don't see within the Commerce pull-downs in the Admin panel any way to do that similar to how fields are added in other Drupal forms.  I assume Commerce allows such customization.  Of course that data needs to be added into the database records as well.

In addition, how are those additional fields added to the email that is generated when the order is completed?  While the customer may not need it, other people within the ordering / fulfillment process are designated as getting copies of that email and need that information within the email.


texts:
How do I print individuals fields in block.html.twig when is a node in a block?

The template is working fine. I can hard code some random text and it is displayed. I just can't display the field values.

I have already tried

{{content.my_field.0}}
{{content.my_field[0]}}
{{node.my_field.0.value}}
{{ content.my_field }}

But, after clear the cache doesnt work


texts: in drupal 7 's view, how to comment without redirecting to content type page?

texts: I make a view for a specific content type, the path of content type and the path of the view are different. Now I put a form into the view, in order to comment on that content type. However whenever I comment on the view page, the view page will redirect to the path of content type, so the question is how can I comment without redirecting to the content page but staying on the view's page, perhaps working with ajax?


texts: Form #states only work after change, but not on initial load

texts:
I've got a paragraph with a select field field_colorschema, depending on its value two other fields field_image field_parallax  on the same paragraph are shown or hidden. The code I've written works for most parts, but only AFTER change of field_colorschema. It does not set the correct state on page load.

function wt_base_field_widget_paragraphs_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
  /** @var \Drupal\field\Entity\FieldConfig $field_definition */
  $fieldDefinition = $context['items']->getFieldDefinition();
  $parentEntityType = $fieldDefinition->getTargetEntityTypeId();
  $parentEntityBundle = $fieldDefinition->getTargetBundle();
  $parentEntityFieldType = $fieldDefinition->getType();
  $parentEntityFieldName = $fieldDefinition->getName();

  /**
   * Conditionally hide background image and parallax depending on row colorschema
   * http://agaric.com/blogs/conditional-fields-paragraphs-using-javascript-states-api-drupal-8
   */
  if ($parentEntityFieldName == 'field_pagebuilder') {

    /** @see \Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget::formElement() */
    $widgetState = \Drupal\Core\Field\WidgetBase::getWidgetState($element['#field_parents'], $parentEntityFieldName, $form_state);

    /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
    $paragraph = $widgetState['paragraphs'][$element['#delta']]['entity'];
    $paragraphBundle = $paragraph->bundle();

    // Determine which paragraph type is being embedded.
    if ($paragraphBundle == 'row') {
      $dependeeFieldName = 'field_colorschema';
      /* field_colorschema option value is one of ['--color-default', '--color-bglight', '--color-bgdark', '--image-bglight', '--image-bgdark'] */
      $selector = sprintf('select[name="%s[%d][subform][%s]"]', $parentEntityFieldName, $element['#delta'], $dependeeFieldName);

      // Dependent fields.
      $element['subform']['field_image']['#states'] = [
        'visible' => [
          [
            $selector => ['value' => '--image-bglight'],
          ],
          [
            $selector => ['value' => '--image-bgdark'],
          ],
        ],
        'required' => [
          [
            $selector => ['value' => '--image-bglight'],
          ],
          [
            $selector => ['value' => '--image-bgdark'],
          ],
        ],
      ];
      $element['subform']['field_parallax']['#states'] = [
        'visible' => [
          [
            $selector => ['value' => '--image-bglight'],
          ],
          [
            $selector => ['value' => '--image-bgdark'],
          ],
        ],
      ];
    }
  }
}

I've also tried inverting everything negative logic (invisible...), because the default value on field_colorschema forces the other 2 fields to be hidden, but again it worked only after change, and not on the initial page load.

What am I missing so that field_image and field_parallax are correctly following field_colorschemas values on the intial page load?

PS: The paragraph subform is inside a Field Group tab, but I think that doesn't matter, because the given code works after selecting values.


texts: Currently, the whole email generated by the Contact module is without a single line break. They look very ugly. Is there a way to edit the email template for specific contact forms?


texts: I need help with the devel module. I'm outputting my objects/variables with dpm($variables); into my template.php and I get the same output on every page. It's pulling one of my views and showing it as the markup for every page. I'm running Drupal 7 with my own subtheme of the Omega project. Any ideas what's going on?


texts: logout with api rest drupal not workign with ionic3!

texts:
hi i try to logout from drupal8 using api rest but i recieve this Forbidden 403
y code is look like this :

 deConnecter(){

   let apiloginUrl = 'http://domaine.com/user/logout?_format=json';
   let headers = new Headers();
   headers.append('Content-Type', 'application/json');
   headers.append('X-CSRF-Token',localStorage.getItem('loggedin_token') );
   this.http.post(apiloginUrl,{headers: headers})
       .subscribe(data => {

        this.connection = undefined;
        localStorage.removeItem('loggedin_token')
        this.navCtrl.push(LoginPage);
        console.log(data);

       }, error => {
         console.log("Access Denied");
       });

}


texts: Drupal Login for my Android application?

texts:
How to use drupal login in my android application I want to use the same database that is used in the drupal site.I want to login with the same user name and password that is used in drupal

Please any one help me with this


texts:
I have multiple user role and different registration forms for each role.
It means that for each registration form, there are different fields.

I when a user select her role, the registration form should change.
can I have several registration forms?


texts: How to change #theme function of specific menu items?(not all of them)

texts:
In my site I have a menu array that is printed in my page via drupal_render function.

I checked the array via krumo()* function and I found each item (link) has a property names '#theme' with value 'menu_link__main_menu'

If I use function theme_menu_link() in template.php (in theme folder) it will change all menu items but I don't want to change the theme of all menus. I want to change only specific item theme function.

So before using print drupal_render() function, I changed the #theme property of my selected link item directly.

For example

$menu_array[218]['#theme'] = 'custom_theme_function';

** 218 is the key of one of the link item in menu_array

but in this step, I don't know how should I define custom_theme_function in my theme template.php

I defined THEMENAME_custom_theme_function ($variables) {} in my template.php
* THEMENAME is replaced by name of my theme

but it doesn't work. I don't know if I want to set a custom theme wrapper for specific menu items, How can I do that?


texts: is there any clean way to override _forum_topics_unread function call from template_preprocess_forum_list without hacking the core?


texts: Programatically create 'Send this user a a private message link' for user pages

texts:
I know that this question had been asked several times, but it seems like all existing answers only apply to ealier versions of Privatemsg module. I am running 7.x-2.x-dev and I would like to programatically render the "Send this user a private message" link. The PHP code is supposed to be the $block['content'] of a programatically created block that will be displayed on user pages.

Somebody suggested to useif ($account = menu_get_object('user') ) {
      if ($url = privatemsg_get_link(array($account))) {
        $block['content'] = l(t('Send this user a private message'), $url, array('query' => drupal_get_destination()));
      }
}but this is doing absolutely nothing.

I also want that the link is only displayed if the viewed user has enabled the "Enable private messages" option in his/her account settings and if the viewing user has permission to send messages. Any ideas how to achieve this?


texts:
How can I hide the label of form in advanced forum?

My content type:forum topic->comment display->comment:label is already set to be hidden

Edit : I realised that it's a form


texts:
I have created a view based off the webform submission data.  So if [Mary] has submitted five forms, and [Julie] has submitted three and [Steve] has submitted 8--  When they look at my results page, I only want julie to see her rows/submission info, Mary should only see her five rows and steve his 8.

The users are authenticated users so they have to login to complete the form and I capture their user and other personal info and of course to access the results page they must me authenticated as well.

I thought getting the submission data layed out in the view was going to be the hard part.  I want the user to click on a link to "previous submissions" and when the results page opens, only their rows appear.  I know the query will be return all the rows where the userID matches the userID of the currently logged in user.

I'm thinking this is hard because I am using webform submission data versus typical views of regular content.

Any help ?


texts: Why is hook_node_access($node, $op, $account) called with $op equal to "create"?

texts:
I am using the function mymodule_node_access($node, $op, $account) to intercept the operation of creating a new node type "article" by the user Advertiser.

I created a new user "Advertiser"
The new user "Advertiser" has all permissions enabled on the node type "article"
The user "Advertiser" can use the admin bar
I created a custom module to control access to the node by the user "Advertiser"
In mymodule_node_access($node, $op, $account), I displays the values of $node and $op

When the user logs into the system, the function mymodule_node_access($node, $op, $account) displays:

  Type of node: article Operation: create

Why does that happen?

The user "Advetiser" has not yet created a new node type article.

Besides, if I disable the use of the admin bar by the user "Advertiser", the situation does not occur.

How can I fix?


texts: How to configure the views slideshow from the CMS?

texts:
Currently I am configuring the views slideshow from the views edit. where I can set the interval time, slide show type and effect, control of the slideshow pause/stop/start etc.

My need is that I want to configure all these things from the CMS not from editing the view.

Is it possible? Is there any module which will do this? Or any other alternative for this?

Thanks in advance.


texts: How can I defer parsing of Javascript on my Drupal 7 site?

texts:
I am working on some performance issues for a site I launched recently.  Looking at Google's PageSpeed insights I see that High priority on the list is Defer parsing of Javascript. Here is a link:

https://developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fwww.gastonia.com_2F&mobile=false&rule=DeferParsingJavaScript

Wow, over 1 MB of Javascript to parse!! Notice that most of these are from the facebook app (maybe the answers is to remove the fb app, ha!)

Has anyone successfully deferred this in Drupal?  I have tried using script defer="defer", and Google gives suggestions like "add script tags in comments and then eval() them, but they give no examples and I am having trouble finding a good tutorial.  Any resources or direction is appreciated!

On a side note, if you see anything else in that list that is easily overcomable by drupal, please add a comment. The site in question is http://www.gastonia.com in case you wanted to look at the source code.


texts: Quiz Module - Restart (Reload) the question of the quiz when it has been wrongly attempted four times

texts:
I am trying to reload the page (or) make the user attempt the question again if he/she has made four wrong attempts.

I am using Quiz module in Drupal 7.

Is there a possibility?

Thanks


texts: The users cannot edit their own password

texts: I installed the Profile2 module, and users cannot change their own password from the edit profile page. The message just says all changes are done, but when I try to log out and log in back, I get an error about the password being wrong.


texts: How to dump $form in twig template of custom form?

texts:
I am trying to debug $form values on twig template, created for rendering user edit form in my own way but when I am trying to use {{ dump(form) }} or {{ dump($form) }} browser hangs and then system.

I have already enabled debug mode and disabled caching using this link

Could anyone help me with the way to print form values on twig template of mine.


texts: Using same pictures twice in one node (media module)

texts:
I've been using the EPSA crop module for a while now without any complaints. But I've run into a small problem, which I can't fix. I use the media module in combination with the EPSA crop module. When I add a picture twice in one node then only one cutout will be saved and all the same pictures will be cut the same way. So a cutout isn't unique. Does someone have an idea?

Using Media 7.x-2.0-beta1 and EPSA crop 7.x-2.3.


texts: How to define a custom menu and show it like an admin menu in Drupal 8?

texts:
Question: How to define a custom menu and show it like an admin menu in Drupal 8 ?
Goal:
First of all, we have a custom administration theme where we are looking for a custom toolbar solution that stays visible for an "simple" user on the front and backend when logged in.
There is a need for a toolbar at top of page similar like the toolbar module in Drupal 8 core.
We want the following links shows to a user :

Back to site
User with possibility to view and edit their profile
Logout
The Edit option for edit content from the front of the site

Screenshot of the goal :

Research:
I have found there are several solutions for Drupal 7 with modules like Admin menu source, Webmaster menu and with Block Class styles module. But none of them is compatible for using in Drupal 8.
Expected solution:
This custom toolbar should only be for specific user roles("user") showed.
I will do this by creating an custom module but I'm not really sure if I need to inherit from the toolbar core module in Drupal 8.

A complete new toolbar
OR

I can work further on the default toolbar module in Drupal 8 but
there is a need for 2 things: add item "boutique" as example that is
decribed as an answer but also remove an item from the default
toolbar like Devel or Manage tab included the sub links from these items.
Are the two things together not possible then I prefer for creating a
completely new toolbar module from scratch for Drupal 8.

Recap:

Not hide or show items based on permissions
Not just adding items to the default drupal 8 toolbar module

Is that possible ? Are they better/other methods for achieving this goal ?


texts:
I've installed Drush 6 on Windows using this installation package and have ensured that the following is in my PATH variable:

  C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php

When I open the Drush Command Prompt and type "drush status", nothing happens. The cursor moves a line down and blinks as if it's working on executing the command, but nothing is shown, and the process never ends. I have to Cntl+C to get out of it.

The same thing happens in Git Bash. No error messages, nothing. Just the ever blinking cursor. Any idea what's happening or how to fix it? Thanks in advance!


texts: Adding comment by anonymous user creates error in blog

texts: I created a blog using Drupal 7. Admin can add and display comments correctly. But when an anonymous user adds comment, then this was not shown in the unapproved list and the blog page shows error. Already approved comments will be shown in the approved list. But newly unapproved comments from anonymous user won't display. If I delete the unapproved comments from database the blog page works fine. I gave permission to anonymous user to post comments. Anyone please help me.


texts: Adding prefix and suffix to a content type field

texts:
Is there a way to add content to a content type's field in a mechanized way? Say for instance I have a field for how many servings a recipe is going to make but I don't want my user to have to write "Makes" and "Servings." over and over again and risk spelling something wrong.

Is there a way to make it so all she needs is a number field and I can automagically make it say "Makes" [number] "servings."

Perhaps there is a hook or module that I can use?


texts:
I used node_export and UUID to export and then import content from one Drupal 6 site to another.

Do I need to keep these modules enabled for any reason after the import?


texts:
I imported large number of articles from another CMS to Drupal 8.

The content is in HTML and when i open a page i have html not interpreted.

How do i tell Drupal/Ckeditor that the content is in HTML ?

For now the only thing working is when i edit an article and clic on source twice to get the HTML interpreted but i can't do that to the large number of articles that i have.


texts: User account unreachable after migration to D7

texts: I have this weird problem. After migrating to D7, few of the users can not access their accounts so that they can track or change their passwords. They get 404 error instead. They can otherwise use the site as other uses. I am wondering what may have caused this, and how to fix it?


texts: how to refer to fields with multiple values in node--content-type template

texts:
I currently have a template for the article content type.

node--article.tpl.php contains:

<?php
    print render($content['body']);
    print render($content['field_file']);
    print render($content['field_tags']);
?>

All of those fields are rendered just fine. All the values of field_tags are rendered. However I'd like to be able to refer to each individual value of the tags field.

For instance, I'd like to be able to do

    field_tag

and iterate i for each item the field spits out.

I've made some attempts with no luck. I tried

$i = 0;
while($content['field_tags']){
    print "";
    print render($content['field_tags']);
    print "";
    $i += 1;
}

However that just created an infinite loop. I attempted it with

while(render($content['field_tags']))

as well but that created an infinite loop as well. Is there a way to access the tags field as an array? rather than just one element in the $content array?


texts: Howto drag & drop field images in editor

texts:
Is there any possibility/ module to multiupload e.g. 3 three images and drag/insert them into the text field (Body) to the position I want the Images?
After this it should open colorbox gallery when I click on this images in the content.

I painted my problem:

http://i.stack.imgur.com/wVWrK.jpg

regards,
l


texts: In drupal 6 I have a content type with a lot of fields, voting, referenced nodes (as answers), etc. Now I would like to create a very similar content type - same behaviour and everything, there are only 2-3 fields that are different, but everything else is the same. Now comes the question: Should I create a separate content type, setup everything, use separate voting, etc? Or is there a way to somehow 'inherit' everything and change only 2-3 fields that need to be changed?


texts: Is it possible to display a content type (availability calendars) inside a Forms API form?

texts:
I read how FAPI is very flexible.  Well I started using it and after a few minor issues I have it working for a good deal of a multi-part form. (Using #state and fieldset)  Now I want to embed an Availability Calendar in the form and I can not figure out if it is possible.  The newest Availability Calendar is based on entities and fields.  My FAPI/module form is just that, a straight forward form.  To expose an Availability Calendar I have to create a content type.  So I am stuck with a content type instance and my own form module, trying to figure out if I can merge the 2.

I'd really like to keep the calendar inside the form in its own collapsible section (via fieldsets), only exposed in the UI when the user has selected other info. This means I either embed Calendar inside a form, or possibly a form inside the Content Type.

Any pointers ?  Am I missing something to glue these parts together? I considered EntityForms but it doesn't seem flexible enough to make nicer forms. (radios?)  My only solution may mean splitting Avail Calendar off on its own page and make it part of a series in a multi-part form.

I don't mind writing php, I am likely going to modify Availability Calendar booking formlet.


texts:
Using the back button after logging out shows you pages from the authenticated user's session.

I found a solution for this, need to set the header like this to fix this issue-

drupal_add_http_header('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate, post-check=0, pre-check=0');

But the problem where i need to set this header?
I set the header in index.php file. After that i am not able to see any other pages while i am logged in. (getting page not found error)

Any solution, how to fix this issue??


texts: What could happen if cache_form is stored in Memcache?

texts:
I have been tuning cache settings for a large site. I updated memcahed settings and set cache_form to be stored in the Database, cache_form started growing and the amount of transactions along with mysql bin logs, and replicator logs started to eat disk space enormously (I have a database about that is ~ 300GB ). Also, the cron is running fine. So I switched back to Memcache. I need to understand what happens when I have cache forms in a volatile cache?
Also, If this is not an ideal solution, what could I do?


texts: ajax callback on form element checkboxes

texts:
I am having some troubles with ajax on form element checkboxes, in ajax callback form_state is without values and triggering element etc .. why is that?

The form is called with drupal_get_form and this is my element

$form['select_options'] = array(
  '#type' => 'checkboxes',
  '#options' => $options,
  '#ajax' => array(
    'callback' => 'ajax_options_callback',
    'wrapper' => 'options-form',
    'event' => 'change',
    'method' => 'replace',
  ),
);


texts:
I'm creating a e-commerce website, with a type of content "Products". I'm using Search API to be able to have Facets filters on my views. I linked the type of content "Products" to the search API. So i have different facets filers available. Everything is working perfectly.

Now I would to be able to search a product. On my search results page i can have my facets filters.

So I tried 2 options :

1) I found this tutorial and I tried but it didn't work

2) I tried the Search API Pages module
and I have the same problem, nothing is working. When I search something, it found nothing. I tried to find out some tutorials to see if I miss something.

I tried to find out some tutorials about how to use Search API Pages module, but I found nothing useful.

I found this previous post which is similar as my problem :

But that doesn't help me either

Does anyone have an idea ?

Edit : I'm not using Apache Solr on my server


texts: Problem with remote sync because of wrong UUID

texts:
I have a problem with syncing my config to the remote server with Drupal 8. When I pull everything with GIT, and use drush to update the config via drush cim I get the following error:

Attempt to save a configuration entity &#039;field_bestand_en_&#039; with UUID &#039;&#039; when this entity already exists with UUID
&#039;b8bbd770-1533-4680-88cd-3409b0921d02&#039

So the problem is that the UUID doesn't match, the new file for some reason lost its UUID and is null now. I tried adding the given UUID by hand to the right yml file but on every new config update it gets overwritten.

So when I do drush cex locally, the UUID is null again. How can I fix this, I guess deleting the field and creating it will fix it but this is not really an option.

Thanks in advance


texts: I am developing my personal site in drupal 7. Actually i am searching for a module which allows anonymous users commenting with their email or any social n/w like twitter,facebook or google+. Is there any good module available or is drupal 7 supports  anonymous users commenting with their email address ?


texts:
I am creating a custom theme, and I need different page layouts depending on the node types. I can't use the node--xxxxx.tpl.php template, because I need control on the page layout outside the content of the particular page.

How can I do this?


texts: Question is simple, in the views module you can add a normal menu item. But when in the menu itself it can't be translated. Is there anyway to do this, or should I just add the menu item myself instead of letting the view do that?


texts: How to display views exposed filter as links when the filter is a date field with year granularity?

texts:
I have a student project View that I want to filter by year using a date field.

I would like to find a way to have the years appear as links or a menu at the top.

I have tried the Better Exposed Filters module but I don't get the option to display the year as links with a date field.

I have tried making a block view which has the date field rewritten as a link with it's token value(/2010) as well as a contextual filter on the date field .

This works except I get as many 2011's as there are values for 2011.

Is there something I could do with glossary mode?

Anyone know of a way?


texts: How to put google analytics script PHP to my sites?

texts:
I apply a Google analytics service. I got a code.

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'MY UA CODE', 'auto');
  ga('send', 'pageview');
</script>

My drupal use AT Commerce this theme. Where do I put this code to my folder's file? There is an optional method. The php is here where I want to add to my block and let it call the above script.

<?php include_once("analyticstracking.php") ?>

Do I follow the same name analyticstracking.php or just add the above script to an existed php file? Thanks.


texts: What is the quickest way to create a landing page for Drupal 7? The landing page module is currently not available for drupal 7. What sort of modules should I use?


texts:
Is it ok to query the database in a template.php file of a sub-theme. If not where do I put it? Below I have function that is querying the database and it works fine but I want to make sure I doing it the right way =).

function inTheTemplateFile() {
   $query = db_query("SELECT tid FROM taxonomy_menu");
   return  $query->fetchAll();
}


texts: How to collect the node ID on a webform?

texts: I have a view showing many products. Each product has its own nid. There is a 'RESERVATION' link in each product as well. When a client clicks on RESERVATION, I want to take him to a form in order for him to provide some more details. Here is my problem, in that form how may I have a hidden field containing the nid of the product on which the client has clicked?


texts:
Strange behavior: when editing a page, the html code is shortly displayed, after a few seconds the wysiwyg is displayed of another page, including the admin menu and other blocks. It happens only with new created pages, not with older ones.

The "other" page displayed is the civicrm (new) contribution page, with address:

?q=civicrm/contribute/transact&reset=1&id=1

To route the user/register link to this civicrm page,
we needed to link to an intermediate page with only one php function:

drupal_goto('civicrm/contribute/transact',
 array('query'=>array('reset'=>'1', 'id'=>'1')
 )

A direct link does not work.

Now, it seems, when editing new pages, this intermediate page function is activated,
and the all civicrm page (including all menues and blocks) is displayed!

So why is this page activated and how to prevent (or bypass) it?


texts: How can I use permissions to control access to admin/config

texts:
For the purposes of a class, I am trying to use an alter hook and custom permission to control who has access to the admin/config page. Here is my code so far

function mymodule_menu_alter(&$items) {
    $items['admin/config']['access callback'] = 'user_access';
    $items['admin/config']['access arguments'] = array('admin blah');
}

function mymodule_permission() {
    return array(
        'admin blah' => array(
            'title' => t('access config'),
        ),
    );
}

Under permissions, I only have "administrator" checked. However, anyone can see the page. I want to make sure that only those with the "admin blah" rights can see it (and I have to use an alter hook). Any advice?


texts: How can I make search with a substring of a word?

texts: I would like to search with only part of a word,not the whole word.For example when I search name of people,I would like to search only the first 3 letters of the Last Name,not the whole name.Now if I put on  search only the first 3 letters I take no results.For the moment I am using the search api with apache  solr(and perhaps views).Any suggestions please?


texts: Create node fields with values that change every week but old values are being stored

texts:
My company has about 15 oil tanks. Every week a guy checks the remaining oil in every tank and writes down the numbers. I want to create a visual representation of the remaining oil in every tank. I have a drupal installation already setup in my server and I thought that I could incorporate a solution in the existing site. What I have done so far:

I have created a new content type called tanks.
Created the various fields (like tank_id, volume, status etc) that will hold information about the tank.
I also have a field that is called latest_amount where I want to store the most recent measurement of oil in the tank.
I have also written some basic php code that does a simple division (latest amount/volume), gets the percentage of the tank that is full and I'm thinking about drawing with html a basic shape that will be green if it's above 75%, yellow if it's 25%-75% and red if it's below 25% (maybe there is a module that can help me with this drawing).

My problem is that I want to keep past measurements so that I can create a graph with these percentages over the last 3 months. Is there any way for me to keep these stats along with the date that the specific field value has been added? Also, is there a way to restrict node editing to only adding a new value in the latest_amount field every week (i.e. not being able to alter any other information about the tank)?


texts:
I'm building a small custom module and I should somehow extend default user entity by adding about 20 more fields to it.

I located User class definitions from Drupal folder (\drupal-8.1.8\core\modules\user\src\Entity\User.php). There I can see field definitions but that's not right place to do modification for sure :)

Also, I suppose I should add User module as a dependency to my custom module, even though user module is part of the core?

I've done some research and I think I should implement a plugin, but I don't know how exactly and what plugin interface to implement etc.


texts: Add a role to a user during MailChimp subscription

texts:
I'm sorry, I'm a beginner in Drupal 7, and I don't really understand the roles behaviors. I arrive in a website which is already done, and I have to add a functionality : a newsletter for another entreprise but on that website.

So I used Mailchimp to create a list, and the subscription is possible on the website.
But I don't really understand how to send a mass contact to these people because they're not put in a specific role.

So my question is, how can I put people who subscribe to this newsletter in a specific role (Which I already created) ?

I'm sorry, maybe this is a bit difficult to understand, and there can be a lot of mistakes in my message because I'm French.

I read some of the answers in that website and I looked for some others on the internet, but really, it's extremly complicated, I don't even know where to put those php codes I found.

Thank you really much for reading it, if you can help me, I would really be pleased !


texts: Users don't have access to view as soon as relation is added, drupal commerce

texts:
I'm creating a new drupal commerce site and I wanted to create a view of all my products.

I didn't want to use Format: content but Format: fields instead. Of course then I needed to add a relationship to get the right fields like price (which are not part of the product display but rather the product itself) in to my view.

All of this worked rather well, I can see my view and it lists the products nicely.

The problem is that only I, the admin, can see the view.
Authenticated users and anonymous users are not able to see anything.

As far as I can tell, the query does not display a result for them...
(I added a string in the no results behavior section)

I checked all of the permissions needed for this view and made sure that all the content is published and that the view shows published content.

I did notice however that when I remove the relationship, the view does have a result.

I find this rather strange and I cannot find the answer so I turn to you.
Is there anyone here who knows what I'm missing?

Thanks in advance


texts: PHP Error: Call to undefined function module_list()

texts:
In my servers Apache error log I regularly see the entry:

  mod_fcgid: stderr: PHP Fatal error:  Call to undefined function module_list() in /home/example/public_html/includes/bootstrap.inc on line 1074

Lines 1066 -> 1078 in bootstrap.inc are:

function bootstrap_invoke_all($hook) {
  // Bootstrap modules should have been loaded when this function is called, so
  // we don't need to tell module_list() to reset its internal list (and we
  // therefore leave the first parameter at its default value of FALSE). We
  // still pass in TRUE for the second parameter, though; in case this is the
  // first time during the bootstrap that module_list() is called, we want to
  // make sure that its internal cache is primed with the bootstrap modules
  // only.
  foreach (module_list(FALSE, TRUE) as $module) {
    drupal_load('module', $module);
    module_invoke($module, $hook);
  }
}

No errors appear in Drupal's Database logging. Today I have received some white screen 503s when checking the site and each time a new message appears in the Apache log. I have tried clearing caches and running drush cc all.

Does anyone has a suggestion as to what is causing this error or how to resolve it?

Some specifications about my set-up: PHP 5.5.12 (OPcache 7.0.4 as bundled), MariaDB 5.5.37, Apache HTTP 2.2.15, Centos 6.5 and Drupal 7.28. OPcache is 'Up and Running'.

To check if OPcache was the causing the problem I disabled it and monitored the error log. The error message still appears with OPcache disabled, and as it disabling it slows the site site significantly (in the region of 200ms > 600 ms) I have re-enabled.


texts: How to create dependent fields in Entity:baseFieldDefinition?

texts:
I have created a select list of content types in baseFieldDefinition

$fields['ctype'] = BaseFieldDefinition::create('list_string')
      ->setLabel(t('Content Type'))
      ->setDescription(t('Choose content type '))
      ->setRequired(TRUE)
      ->setSettings(array(
        'allowed_values' => $ctypes,
      ))
      ->setDisplayOptions('view', array(
        'label' => 'above',
        'type' => 'string',
        'weight' => -5,
      ))
      ->setDisplayOptions('form', array(
        'type' => 'options_select',
        'weight' => -5,
      ))
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);

Does Drupal provides ajax feature to use in baseFieldDefinition ?

Basically I want to generate field list of selected content type using entity.


texts: Admin (uid=1) access denied to custom module page

texts:
I'm developing a custom module and the last step is to add custom permissions. I've added the administrator role to the new permission, but I see "Access Denied" when viewing /ledger/reports/balance-sheet. I've cleared caches, reloaded the module, and rebuilt permissions. I've even dug into the users.module file in core to verify that it is entering the if uid==1 return TRUE; section of function user_access(). Any help would be appreciated.

/***************************************************************
 * Drupal core hooks
 * *************************************************************/

/**
 * Implements hook_menu().
 */
function ledger_reports_menu() {
  $items = array();

$items['ledger/reports'] = array(
  'title' => 'Ledger Reports',
  'description' => 'List of available reports',
  'page callback' => 'ledger_reports_page',
  'access callback' => TRUE,
  'weight' => 10,
);

$items['ledger/reports/balance-sheet'] = array(
'title' => 'Test Balance Sheet',
'description' => 'The current balance of all asset, equity, and liability accounts',
'page callback' => 'ledger_reports_balance_sheet',
'page arguments' => array(3),
'access callback' => array('view ledger reports'),
'weight' => 10,
);

/**
 * Implements hook_permission().
 */
function ledger_reports_permission(){
  return array(
    'view ledger reports' => array(
      'title' => t('View Ledger Reports'),
      'description' => t('View the accounting reports.'),
    ),
  );
}


texts: How do I add 3rd party CkEditor plugins to the editor?

texts:
I have found a third-party CKEditor plugin I want to add to the editor provided by Drupal core in Drupal 8. What do I need to do to be able to make it possible to add this new option to the editor?

The plugin I would like to add is the image2 plugin (called enhanced images) found on the CKEDITOR site. Based on my research, it appears I'd need to add a YAML and a module file to what CKEDITOR provides.


texts: If parent feeds (import) node is unpublished, how do I not include it in the import schedule?

texts:
If the parent feed imports a node (the form/node to input the feed URL, not the feeds importer) that is unpublished, I'd like to have it (the feed URL) not be included in the cron schedule to update/import the feed items. How is this done? For example, a user submits a feed, but the administrator needs to verify it before publishing, and importing it.

See also Don't import items if parent feed is unpublished.


texts:
I want to join two variables in twig in the user.html.twig

{{ content.field_firstname }} {{ content.field_lastname }}

How can i output them on the same line and add a space between them using twig ?

Everytime i try, they show on two different lines ? and i don't want to use css just for this.

Is there any better way to do this ? Many thanks


texts:
I am doing a site in Drupal 6, and I need to create footer links which needs to be displayed in the footer.

How can I create it?


texts:
I thought I had installed successfully module builder as drush plugin : typing help mb returns complete help story...

But when I try to use it, ie typing mb easyresponsive_panels ctools_plugin_directory menu  --write, it gives me the following error :

  Command mb-build needs a higher bootstrap level to run - you will need
  to invoke drush from a more functional Drupal environment to run this
  command. The drush command 'mb easyresponsive_panels' could not be
  executed. Could not find a Drupal settings.php file at
  sites/default/settings.php.

I have a multi site install, this is why no sites/default/settings.php is found.

I tried to specify root and site explicitly, as per these answers, running  --root=path/to/drupal --uri=mysite.com status, this returns the correct complete status :

Drupal version : 7.24
Site URI : visages_20131224:8082
Database driver : mysql
Database username : drupaluser
Database name : visages_20131224
Database : Connected
Drupal bootstrap : Successful
Drupal user :
Default theme : neptune
Administration theme : adaptivetheme_admin
PHP executable : php.exe
PHP configuration : C:\wamp\bin\php\php5.3.13\php.ini
PHP OS : WINNT
Drush version : 7.0-dev
Drush configuration :
Drush alias files :
Drupal root : C:\Users\Thierry\Sites\visages_20131224\
Site path : sites/visages_20131224
File directory path : sites/visages_20131224/files
Temporary file directory path : c:\windows\temp

(my dev config : Windows 7, Acquia Dev Deskstop, Netbeans, D7)

Related Q&A didn't enlightened me yet, any help is welcome.


texts: I am using drupal 6 and i have created my own content type and few CCK fields. When user is creating a node, i don't want to show him fields like menu settings, revison information, and many others, is it possible in Drupal 6.


texts: How do I get the associated node from a webform entity?

texts:
I'm preprocessing a webform using hook_webform_submission_form_alter. The webform is being rendered as a node field. How can I, from inside my form_alter hook access that node?

function MY_MODULE_webform_submission_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
    $parameters = \Drupal::routeMatch()->getParameters();

    if ($parameters->has('node')) {

        // processing goes here
    }
}

I'm fetching it from the url parameter right now, but I would prefer to do this in a cleaner way.


texts: How can I order views Attachments in views page

texts:
I have created to views attachments and placed them after my views page.
But the issue is the order of the attachments is in reverse.
How can I add weight to them?


texts: Using ajax to process textfield in Drupal 7

texts:
Inside of a hook_form_alter function, I want to leverage the #ajax property to modify/update database tables without leaving the form... In other words, I want the user to be able to fill in the field and either "tab", "click" or "enter" and have ajax respond.

The response should be an update of that field being displayed as well as an update to the DB...

If I can get the call back to wakeup, the DB call is easy. And hopefully the form displays that new data. Code I have so far is:

$form['license'] = array(
  '#type' => 'textfield',
  '#title' => t('License'),
  '#size' => 20,
  '#default_value' => 'default license',
  '#required' => FALSE,
  '#weight' => 10,
  '#ajax' => array(
    '#callback' => 'license_fillin_js',
    '#event' => 'change',
    .
    .
    .

  ),

So far, nothing seems to be waking up the callback.

This is probably very simple! Right?


texts:
I have a view that relies on a specific content type to display images. The Content Type has a Title,  a File Field, and a checkbox for show or don't show.  The default setting for all nodes created using this Content Type is unpublished, so that users can't randomly access the node ( basically it's a slideshow that displays banner ads, accessing the actual node isn't a bad problem per se ).

This works great.  As it turns out I also need a members only section for the site, so I installed Content Access.  That works great for restricting access to the nodes I need restricted.  However, I discovered that now the unpublished Slideshow nodes don't show.

My question is how to work around this.  Will another access module work differently or is this a core feature?  Could I write a small module to grant view access to the Slideshow nodes?  Or barring all that, is there a module or ( I know it's probably off-topic) an htaccess recipe that would not allow direct viewing of the nodes of a certain type?


texts: I am looking for a way to provide a whole menu (no menu items) within a module. I could find many ways how to do that in D7, but I really would like to da that in D8.


texts:
This may sound like a strange question but it is desired functionality from a client. They would like to have a login screen that only staff members can log in through. What I mean by that is if an anonymous user logs in, and if their role is staff (or admin) then they are logged in. If it is any other role, then they are not logged in and redirected to a 'normal' login page.

I know this seems unorthodox but is there a way to accomplish this?

Thanks.


texts: commerce_display_path is relative and doesn't work from Order page

texts:
I'm trying to create a link from the Order view back to the product page so a customer can order it again. I've added a field to the view to load commerce_display_path (and set it as hidden) then another field that is some metadata about the original purchase (the line item is customised and I'll get the product page to read that url and repeat the customisation). That field uses rewrite rules for display like so

Reorder

However the commerce_display_path is relative so I end up with a URL like node/6?bundleId=71398558 and when used from the orders page the browser sees http://127.0.0.1:8080/drupal/user/142/orders/node/6?bundleId=71398558, which is useless.

If I manually put a / at the beginning of the a tag it will get the wrong url because in my test environment drupal is running as /drupal. I could put /drupal in but I think there should be a better way to get the sites base url into the rewrite rules.


texts: I need to add a body class if a block or menu is present on the current page on Drupal 8. Probably this should be done on template_preprocess_page() or template_preprocess_html().


texts:
I am using Composer on a Lightning drupal distro. In my composer.json file I set enable-patching true. And I added one core patch for /patches/core-file_upload_ajax_message-1489692-68.patch. WHen I run composer update it applys 3 other patches. See output. Is Composer doing this by itself?

Applying patches for drupal/core
./patches/core-file_upload_ajax_message-1489692-68.patch (Incorrect handling of file upload limit exceeded - file widget disappears)
https://www.drupal.org/files/issues/no_hook_to_edit-2822460-2.patch (multi-value field widget hook)
https://www.drupal.org/files/issues/2652138-41.patch (2652138 - ImageFormatter does not support SVGs)
https://www.drupal.org/files/issues/1356276-303.patch (1356276 - Allow profiles to provide a base/parent profile and load them in the correct order)


texts:
I have two separate fully developed Drupal 7 sites, which I now want to make as Multi-site.

I did it like in the above pic, and it worked, except all the images on both sites are broken.

Upon inspecting element, the paths are still trying to read from /sites/default/files folder instead of /sites/site1.com/files and /sites/site2.com/files respectively.

How can I fix the paths so it reads from /sites/site1.com/files and /sites/site2.com/files?


texts: Share a value between two different hooks

texts:
I have 2 hook functions in my module: hook_views_pre_render() and hook_form_alter(); in hook_views_pre_render(), I retrieve some data about what nodes that are available that I need in hook_form_alter().

I'm looking for a way to pass the data from hook_views_pre_render() to hook_form_alter(). It seems simple, but I can't get it to work. Does anyone any idea?

What works for the moment is to add global $aVariable to both the hook functions, but I believe there should be a better way.


texts:
I'm using the Form API to create a Date of Birth field with  lists for month, day and year.

$form['dob'] = array(
    '#type' => 'date_select',
    '#title' => t('Date of birth'),
    '#default_value' => '',
    '#date_format' => 'm-d-Y',
    '#date_label_position' => 'within',
    '#date_year_range' => '-100:+0',
    '#required' => TRUE,
);

Sine the default value is blank this outputs the following:

How can I alter the labels? Specifically I want to get rid of the '-' characters so it looks more like this


texts: How does one diplay only the referenced entities associated with specific node in a view block?

texts: I have two content types that are related to one another with and entity reference field, Research project and Profile. In my block display view, I would like to display only the entities that are referenced by a specific Research project.


texts: Is there any possibility to migrate translations from Drupal 5 based project to Drupal 7 project?

texts: I have a legacy Drupal 5 project which is currently moved to a newer Drupal 7 platform, but the old project also contains a lot of custom translation sets. So I am wondering if there is any possibility to migrate those translations to the new project?


texts: Is there a setting to add a suffix and prefix to a list(integer) field like there was in Drupal 6?

texts:
I am in the process of migrating a Drupal 6 site to 7. Several of my content types have a field called "Rating" which was an integer field in D6 that used a <select> to choose a value 1-10.

In the process of migrating to D7 this field was converted to a list(integer) field. On the old site I was able to add a suffix of "/10" to this value in the field's settings so the field would always render as "#/10". However, in Drupal 7 there is no longer a place to set this suffix on the field's setting page.

Does this setting exist anymore for this field type? If not, do I have any options for adding this suffix outside of creating a custom "field--field-rating.tpl.php" template?


texts: How do I remove the header background image in Pixture Reloaded theme?

texts: I'm not sure why this is difficult, but how do I remove the default background image in the Pixture Reloaded theme?


texts: What is the best way to minify drupal's aggregated javascript (automatically)?

texts:
Have just run Google pagespeed over my newly created drupal 6 site, and it reports:

Minifying the following JavaScript resources could reduce their size by 15.6KiB (12% reduction).

    Minifying http://[sites]/sites/default/files/js/js_9f19b87ffb72ca233ea7e45dda2f20f9.js could save 15.3KiB (18% reduction). See optimized version or Save as.

The above file was generated through drupal's default JavaScript aggregation method, but apparently it could be 18% smaller (which is a big deal for this site). What approach is considered the best when it comes to minifying JavaScript on a drupal site without breaking any existing code?


texts: Update commerce cart block when product added through ajax

texts:
Hii How can I update commerce_cart_block when my product is added through ajax.
Any suggestion will be helpfull.


texts: Is there any way to fetch all users into a list in rules?

texts:
I want to know if there is any way to fetch all users into a list in Rules?

I used Views Bulk Operations (VBO) and "Load items from VBO" in Rules. But it seems it doesn't work !!


texts:
Can we customize user login block in Hybridauth module in our custom theme?
Like writing block-hybridauth-hybridauth.tpl.php.

I need to customize the way of output. Instead of the Sign In icon which gives the overlay of enabled social accounts list, I need some text to replace it and add div and content along with it? Is it possible?


texts: Printing individual components of comment-form in comment-wrapper.tpl

texts:
In my comment-wrapper.tpl.php I was doing

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

which worked fine. But to render  the comment-form according to given theme, I tried doing this:

<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>

   print render($content['comment_form']['author']);
   print render($content['comment_form']['field_email']);
   print render($content['comment_form']['comment_body']);
   print render($content['comment_form']['actions'['submit']);
   print drupal_render_children($form);

 if ($content['comments'] && $node->type != 'forum'):
     print render($title_prefix);

<?php print t('Comments'); ?>

     print render($title_suffix);
endif;

This code is printing all the components of the form  but the submit button is not working as it should. When I click the submit button it is not giving any reaction. Do I need to add any more lines of code to make this comment form work  ? Thank you.


texts: Weirdness in views when grouping by a field, and a user has more than one entry in that field

texts:
I have a view that shows users. Users are associated with an Area in the organization.  The view groups by Area (a vocabulary) and gives a list with nice area headings, with a list of Users inside it.  Unfortunately there is one executive in the organization that is also in charge of another Area, and he needs to appear in both places.  When I assign both areas to his account (entity reference field), we get the following (problematic user in bright blue):

What should happen, is that the blue user should appear once in the Executives area and once in the PMO area.  Instead as you can see, he appears twice in his own special Executives \n PMO area.  It would even be ok, if he only appeared in the Executives area here.  What can I change to get this view to be nice to me?


texts: different HTML-structure with other languages

texts:
When I add a new basic page in default language, the HTMLstructure is like:

But when I translate that page (or create a new page in another language), the article is not within the div's. The HTML-structure is like:

I've no idea how to solve this. Where do I have to look? Is this a setting, or do I have to change s


texts: Getting Drupal 8 to use an external index?

texts: I have two sites one is maintained by us in drupal 8 and the other is maintained by another company that does the news updates etc for our company. I'm trying to figure out the best way to get a combined search in drupal. So set up a Solr instance and setup a web crawler to crawl the other site, set up drupal 8 to use the search api and solr search. But now i'm not sure what's the best way to integrate the index created by the web crawler with drupal 8. Any ideas?


texts:
I'm working on a custom module and want to use phpoffice/phpexcel

I can install the library just fine with composer require phpoffice/phpexcel, but what if I update Drupal-Core to a new version and by doing so override the composer.json? I would have to remember to do another composer require ... to add the dependency again.

What is the right way of doing this?
I have a similar problem with the address-Module, which also requires to be installed with composer.


texts: Views, how to show x-items from each tag?

texts:
I wan't to create an view that show MAX:10 items of tags (football,basketball,tenis etc...)

I want the view to show 3 items for each tag

[football_article_1]
[football_article_2]
[football_article_3]
[basketball_article_1]
[basketball_article_2]
.....

Any idea?


texts: How to find whether the term is first or last in a vocabulary?

texts:
I am using a vocabulary to get the list of terms in it. The tids for the terms are 1, 2, 3, 4, 5. I have no hierarchy in my taxonomy. Now I would like to find whether 1 is the first term in the vocabulary, similarly to find whether 5 is the last term in the vocabulary.

Is there any API way of doing this?


texts:
I almost always have over 30 jobs behind schedule in Ultimate Cron, and I'm trying to understand why that is, and how I can fix that.

I am using Ultimate Cron 2.x, with Background Process.

A good portion of my jobs say something like, "8 months behind schedule" and the most recent one is 3 weeks behind schedule.

Why do my cron jobs keep running behind schedule? How do I fix this? Is this a configuration error that I caused in Ultimate Cron? Or would this be due to a bug?

EDIT: I'm also sometimes getting an error that says:

"Could not get lock for job system_cron"

And I also found this:

"UltimateCronBackgroundProcessLegacyLauncher::poormanLauncher" under locked job.


texts: Inject a theme setting form into a block

texts:
Is there a way to inject the theme settings form into a block so it could fix to the left-hand side of the page when admin logins?

The url that would be injected into the block would be

admin/appearance/settings/<theme_name>


texts: Creating image gallery based on picture field and filters

texts:
I have two content types ( Man, Woman ) with machine names ( man_type, woman_type ).

They have same fields ( title, url path settings, Body, size, type, price, picture, color ) with different machine names for custom fields ( woman_type_size, man_type_size / woman_type_picture, man_type_picture / .. etc ).

Now i wanna do 2 things :

1 - Create a Gallery with Views module ( i think ) that only shows the picture field of the specified type with this kind of url : ( http://website.com/gallery/man,  http://website.com/gallery/woman )

2 - Shows pictures based on filters ( like size,color,price ... ) - that they are already  entered when posting new content - in the URL like this :
http://mywebsite.com/gallery/man[indicates type]/jeans[indicates clothing]/black[indicates color]/38[indicates size]/40[indicates price]

I am very appreciated if you can help.


texts: How to trigger form AJAX callback if the form did not validate?

texts:
I attached an AJAX callback to first/last names on the registration form.
When user enters both, the callback generates automatically the username and shows it in the form.

The problem is that the callback is not executed if the form fails validation.
I want still to execute it, and if the user has entered first/last names, to show the username on the screen.

I found this post here, but it doesn't seem to be working.

Does anyone have any ideas how to do this?

Thanks!

UPDATE

Here's simplified code I'm using:

function sample_form($form, &$form_state) {
  $form['first_name'] = array(
    '#type' => 'textfield',
    '#title' => t('First name'),
    '#ajax' => array('callback' => 'sample_username_ajax_callback'),
  );
  $form['last_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Last name'),
    '#ajax' => array('callback' => 'sample_username_ajax_callback'),
  );
  $form['#default_username_text'] = t('Username will be automatically generated.');
  $form['username'] = array(
    '#prefix' => '
',
    '#markup' => $form['#default_username_text'],
    '#suffix' => '
',
  );
}

function sample_username_ajax_callback($form, &$form_state) {
  // Make sure that both first and last names are set.
  if (!empty($form_state['values']['first_name']) && !empty($form_state['values']['last_name'])) {
    $markup = t('Your username will be @username', array(
      // I have a processor function here, but for the sake of clarify I removed
      // it.
      '@username' => $form_state['values']['first_name'] . '.' . $form_state['values']['last_name'],
    ));
  }
  // Either the fields are empty, or the user deleted them.
  else {
    $markup = $form['#default_username_text'];
  }

  // Get the username element; we will update it and replace the old one with
  // this one.
  $element = $form['account']['username'];
  $element['#markup'] = $markup;

  // Build the commands.
  $commands = array();
  $commands[] = ajax_command_replace('#signup-username', drupal_render($element));

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


texts:
Possible Duplicate:
  Meta tags on Views in Drupal 7

Tried metatags module, it is great, but can only set meta for Content, Tax, Front, etc, not for Views.

How to set metatags info for Views page? programmatically or by module

Thanks.


texts:
I'm using Drupal 7. I made a couple of content types and taxonomies. Is there any way to select multiple content in the same content type and modify their fields together?

For instance, I have account type with the fields: account number, test case, ...

I want to set multiple account contents' test case to the same value.

Note: the test case is just a field with a selection of test case names, sry about the confusion


texts: How to build links compatible with clean and "dirty" URLs?

texts:
I have a development site that doesn't support clean URLs, my production site does support them.
If I build a link in the body of a node like:

View something

This shows ok on my production site but gives a 404 while in development site.
How do I build universally good URLs ?


texts: what's the difference between using js injector module and ['#attached']['js']

texts:
Please can any one tell me what's the difference between:

adding a java script to a webform using js injector module
And
adding it using Implements hook_form_alter() and $form['#attached']['js']


texts:
I am creating a custom block plugin to display a content type called "media". On this plugin I have a blockform entity autocomplete to choose which media node to display. Currently, it does not autocomplete with any of my test media nodes. I am sure the rest of the plugin is working, I am just not able to select any of my nodes.

Media content type:
Machine Name: media

blockform element:

$form['blurb_node'] = [
        '#type'               => 'entity_autocomplete',
        '#title'              => $this->t('Media'),
        '#target_type'        => 'node',
        '#selection_settings' => ['target_bundles' => ['media']],
        '#default_value'      => Node::load($this->configuration['blurb_node']),
    ];

UPDATE: I am able to manually type in the name of a node, but the autocomplete functionality does not work at all.


texts: Can I organize my custom module's twig templates into subfolders?

texts:
My module now has a lot of TWIG template files in the /custom/MYMODULE/template folder. I tried creating some sub-folders because I thought Drupal 8was supposed to search all sub-folders automatically but I got an error about a missing template file. Should it work?

I've tried setting the subfolder name in '#theme' => 'SUBFOLDER/mytemplate' and I don't get an error, but the block contents are just blank (although the title displays).

I have my template defined in MYMODULE_theme(), but it feels wrong to specify a sub-folder in there.


texts:
Drupal 7.
There is a service, there will send the request, it returns an xml. With the handler present in human readable form. We bring a response variable. How to display the value of this variable on the page?
I created a page with hook_menu:

function mymodule_menu() {
  $items = array();
  $items['serch'] = array(
    'title' => 'Result',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('mymodule_proc'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function mymodule_proc($parms){

}

In the FORM API I have not found a suitable element.
If use it hook_page_alter, I don't know how apply to the content?

$page['content']['system_main']['pager']
$page['content']
$page['content']['system_main']

or something else....


texts:
Popular Drupal 7 modules such as Views Calc and Views aggregate plus are not available for Drupal 8, so I'm struggling with achieving the following :

Making the sum of a column (of one integer field of list of child nodes) per parent node, without any custom code. No matter what I do with the "Use Aggregation" feature , I keep on getting a list of the values of entities meeting my criteria and not the sum.


texts:
Is there a way to add another form to the /cart page in drupal commerce? I have a need to show another view with operations on the cart page for stored shopping carts and quotes. I don't want to change the existing cart view, but add another view to that page.

Is there a way to make this into a panels page and still integrate with the rest of checkout? any suggestions?


texts:
I am using Drupal 7.

When I am running cron manually as an admin, I get white page.
When I am looking at the dblog report immediately after trying to run cron, I always see the following notice:

TYPE    job_scheduler
DATE    Monday, March 17, 2014 - 00:15
USER    Guest (not verified)
LOCATION    http://www.site.com/admin/reports/status/run-cron
REFERRER
MESSAGE Finished processing scheduled jobs (0 sec s, 0 total, 0 failed).
SEVERITY    notice

It is also strange that the user of this activities is "Guest (not verified)" and not Admin.

Yesterday I made alot of changes and installed some performance module as the boost module, file cache module and advagg module. But I always run cron after installing a module.
After few tests and enabling/disabling modules, it looks like that the problem is the filecache module

Can someone help me solve this issue?


texts: Automatic base URL not picking up https://

texts:
My Drupal site is using https:// but the base URL is not using it.

My site therefore is not opening properly. Is there any way to make Drupal pick up the correct base URL?

I tried adding $base_url in settings.php but it's giving me this error:

  GET https://example.com/js/admin_menu/cache/6599fa6c7ea0ac232a88eaa63e957878 404 (Not Found)


texts: How to alter storageSettingsForm in a custom Field Type definition, set default cardinality and not allow change

texts:
Trying to set Allowed number of values always to be 1 and not allowing multiple values for a custom Drupal 8 field.
How to do that?
Do I need a form_ID_alter or a storageSettingsForm/defaultStorageSettings implementation?

I see this field is not included in the storageSettingsForm $form or parent::defaultStorageSettings()

Not sure if the best way is to set it as configuration or alter the form.
Is there an annotation for this or something?
Any example module that does this?

Thanks


texts: How do I add different URL to the HOME link in the breadcrumb for the authenticated user

texts:
I'm using breadcrumbs in my drupal 7 website.

How and where do I change the URL for the [home] breadcrumb, based on role/authentication of the user - when the authenticated user signs in, they are taken to role based page, when they hit the home breadcrumb, I want them taken back to their role-based home page/url, not the main/anonymous user home page.

I think I want to add a preprocessor function to the template.php that will say--> function themename_breadcrumb() {if auth_user home url is $this else $homeURL is $this}.  How would I write this?


texts: How do I write a behat test to go to user/UID/somewhere when I only know the username?

texts:
I'm trying to write Behat tests to verify my Drupal Commerce store.
My test creates some users, so I know the usernames but not the UIDs (the UIDs are assigned by Drupal in the test, so they will be different each time).
So, I want to get the UID based on the username, and then redirect to the payment method page for that user with a step like When I go to the payment method page for username ABC.
Here's my code:
  /**
   * @Then I go to the payment method page for username :username
   */
  public function iGoToThePaymentMethodPageForUsername($username) {
    $user_object = $this->userManager->getUser($username);
    $uid = $user_object->id;
    if (!(is_int($uid))) {
      throw new Exception("UID is not a number ('$uid')");
    }
    $this->visitPath("user/$uid/payment-methods");
  }

However, this code fails with the following error message:
  No user with ABC name is registered with the driver.

When I checked this->userManager->getUsers(), I found that it only has the users generated by the Drupal extension in the current scenario; I cannot access the users who have been registered in other scenarios or users who have already registered outside of Behat.
What's the correct way to get the user object for such a user?


texts: Site is down due to MySQL error but it returns 200/OK

texts:
A site I help administer was showing a uncaught exception page.

  Additional uncaught exception thrown while handling exception.
  PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL
  server through socket /var/run/mysqld/mysqld.sock& (111) in _registry_check_code() (line 3154 of home/jcorneli/beta/includes/bootstrap.inc).

The server returns 200/OK.  The .htaccess files contains the following lines.

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

Is there a way to make Drupal return the correct HTTP status?


texts: Troubles with adding video provider to Video Embed Field module

texts:
I have installed Video Embed Field module, youtube links works good. Next I have installed Video Embed Wistia, and can't set valid Wistia's links. The error is

  Could not find a video provider to handle the given URL.

Video embed field and Video Embed Wistia modules are on in admin/modules

What I have missed? Why it doesn't work?


texts: How to give a particular role, the right to register new user

texts:
We have been targeted by spam bot, and decided to set the option "Who can register new user" as "Administrator only". So far so good.

I would like to let another role (Webmaster) create users as he wishes.

In the permissions settings, I checked the checkbox for "Administer users", but I feel like the option "Administrator only" in the account parameter is overwritting this.

Anyone has an idea of how to do this?


texts:
I am working on a site that integrates with our company's ordering and payment system. I have a flow I need to create that, after the customer clicks the checkout button, it takes them to a login/register page, then to a place to enter their shipping and billing address, then to a shipping page (which our service provides the shipping costs), then to a payment page. I created a custom flow called 'SRSCheckoutFlow' and here is my code:
class SRSCheckoutFlow extends CheckoutFlowWithPanesBase {

    /**
     * {@inheritdoc}
     */
    public function getSteps() {
      return [
          'login' => [
            'label' => $this->t('Login'),
            'previous_label' => $this->t('Return to cart'),
            'has_order_summary' => FALSE,
          ],
          'order' => [
            'label' => $this->t('Order Information'),
            'previous_label' => $this->t('Return to login'),
            'has_order_summary' => FALSE,
          ],
          'shipping' => [
            'label' => $this->t('Shipping Service'),
            'previous_label' => $this->t('Return to order information'),
            'has_order_summary' => FALSE,
          ],
          'review' => [
            'label' => $this->t('Review'),
            'has_order_summary' => TRUE,
          ],
          'payment' => [
            'label' => $this->t('Payment'),
            'has_order_summary' => TRUE,
          ],
          'payment_processing' => [
            'label' => $this->t('Payment Processing'),
            'has_order_summary' => TRUE,
          ],
        ] + parent::getSteps();
    }

  }

Problems are when I am not logged in, I go to the login/register page as desired but after I register, I get sent to a blank Checkout page. If I am already logged it, I get sent to the shipping page which misses the part where I need the user to add their shipping and billing information.
In Home > Administration > Commerce > Configuration > Checkout flows, I have all the steps created in the SRSCheckoutFlow and I added the following to each step
Login

Login or continue as guest

Order Information

Shipping information
Contact information

Shipping Service

Shipping Services (which is custom and showing correctly)

Review

Review

Payment

Payment information

Am I missing something in the flow that jumps over the Shipping information and Contact information sections?


texts: I am using Menu Token to create a link to a customized profile edit page that uses the url "user/%uid/edit". I've set the title of the link to "My Account" and although it works for my (admin) account, for the other roles the title is "Edit" instead (the default Drupal tab name for the /user menu item) and futhermore it does not appear to be the active trail. My thinking is that it's something to do with permissions since it works in one role but I can't seem to figure this out. Any help?


texts: Bookings API versus existing spaghetti code

texts:
I'm working on an appointment booking system that allows registered users to book an outcall with an agent.

I've only come across Bookings API and Public Bookings, which seems more for things like library work rooms than it is for service industry people -- and even then, nothing about it looks at all pretty (Not a knock to the devs; it just isn't at the point comparable software is at on other CMSes.). My client has an existent system coded in some pretty funky PHP -- nothing OO, all logic code is in the same file as the design code (which is in, get this -- tables. Everything. In tables.) -- and I'm currently thinking about porting it to Drupal.

My questions are thus:

a. Are there any alternatives to Bookings API for appointment booking?

b. If not -- and considering I don't have a ton of Drupal programming experience -- would it be more worthwhile to update the existing spaghetti code appointment booking system to function as a Drupal module, or more worthwhile to just make Bookings API function more eloquently in this usage case (considering it has a lot more functionality, hooks, etc. than I could probably program into a new module in a short time)?

Thank you!


texts:
I am able to sell a file using Ubercart Drupal 8 module. However, file download permissions are not granted to the user purchasing the file.

Do we have a Rule in place for this? How can I achieve this?

I have a product which has two options: Hard copy and E-book. E-book is associated to a file download and with a role (publication owner) assignment option. Upon purchase, user should be granted publication owner, but this doesn't happen. Also, if I go to user/uid/purchased-files the file is not listed between the available downloads.


texts:
Is it possible to get the original entity in a constraint?
Use case: create a constraint on which item can be deleted in a multi value field


texts: Trouble with Drupal 8 REST API and JavaScript client

texts:
I have created a Drupal 8 site and enabled REST on it. I can successfully preform requests against it using Postman or curl. However, when trying to perform those requests from a JavaScript application, I receive a "Access-Control-Allow-Origin" error.

How do I configure Drupal to allow these requests?

Edit:

I ended up switching from Nginx to Apache for my server and following this guide for enabling CORS in Apache

Enabling CORS in Nginx should be possible, but I could not get it to work.


texts: I have a view, which is listing nodes. I like to exposed filter it by tags (what is a taxonomy). But I like to show tags, what is relevant (has nodes) for the current view. How can I make it?


texts: Saving values using variable_set through an array

texts: I have used variable_set to save one value. How can I save multiple values through an array using variable_set?


texts: I'm getting a couple of user registrations on my personal website (presumably from bots or people trying to hack my site). How do I disable new user registration entirely?


texts: Accessing a Entity Refererenced field of the current node

texts:
I have to render a field of a node that is inside a content type in Drupal 8.

I have a content type called summary that has a field, called field_content that is an Entity reference field for unlimited items of a specific content type (article)

I'm able to get the current node and handle the field_content, but I cant access each of referenced items  inside  of this type.

Also I have tried to debug the field_content with  kint but the browser crashes (I suppose that it happens becasue the data dump is very big) and I can't access the inner properties (I have to get a field called field_desc_text inside each article).

I need the node or the nid to load it  of each of this inner items.

This is what i've tried:

       $currentNode = \Drupal::routeMatch()->getParameter('node');
    foreach ($currentNode->get('field_content') as $nodeRef)
    {
      kint($nodeRef); //*This debugs the entire referenced node, but there is no sight of my desired fields
      die;
     // kint($nodeRef[0]); *Cannot use object of type Drupal\\Core\\Field\\Plugin\\Field\\FieldType\\EntityReferenceItem as array
     // kint($nodeRef->get('title')); *Uncaught PHP Exception InvalidArgumentException: "Property title is unknown."

     die;

    }

And this is the output of the kint($currentNode):

https://mega.nz/#!Fogx0LpC!CYvc6YSRs1ZcgOAc4RCfDo5iVqjBLYckvuFEUgqRGx8

Thanks in advance!


texts:
I have a view in Drupal 7 that displays a list of all the nodes of a content type in alphabetical order. What would be the best way to implement javascript that only displays nodes starting with a specific letter, say, all nodes starting with the letter 'A'? I would also like to add a list of letters as links at the top to trigger the show/hide effects.

It's probably worth noting that I currently have javascript to achieve this using data gathered from an external database and implemented via a custom module. Ideally, I want the same functionality but want all the data to be coming from Drupal nodes.


texts: How do I use the Bootstrap theme carousel?

texts:
The Bootstrap Carousel locates in the following folder. As I know, in Drupal 7, I could use Bootstrap Carousel in a view. In Drupal 8, how could I leverage this plugin in my website?
bootstrap -> src -> Plugin -> Preprocess -> BootstrapCarousel.php
class BootstrapCarousel extends PreprocessBase implements PreprocessInterface


texts: How to redirect all variations of a domain to https version?

texts:
Google has started punishing non https sites both in SEO and their browsers. So I guess we must make sure that all our clients are using https

Assuming that I have a domain example.com I would like to redirect all the variations of this domain to the https version.

There can be six variations
example.com, www.example.com, http://example.com, http://www.example.com, https://example.com, https://www.example.com.

I want to make sure that all these variations redirect to https://www.example.com.


texts: How do I output a hidden password field as part of Drupal form?

texts:
I want to alter an existing Drupal form built with form API to contain a hidden password field.  (I.e. I want to create a honeypot field in the form that only 'bots will see and fill in, while humans will leave this field it empty).

The HTML I want included in the form shall be something like this:

<input type="password" name="password" style="display:none;" />

I've looked  at hook_FORM_ID_alter, but so far I haven't seen how it can help me with this.

I think I am looking for a way to theme this particular field, some way to manipulate the HTML after it has been rendered, but before it shown to the human (or 'bot), but I am open for other answers as well.

(For what it is worth: I am using Drupal 7.)


texts: I made a bunch of changes to a D8 view and have not saved it yet. I decided I don't want to go through with these changes and I want to discard all unsaved changes. How do I do this?


texts: How can I remove "please wait..." from a form?

texts:
I saw this Remove the "Please wait" text on Ajax Call but I can't find the form element. <?php dsm($form);?> and <?php dpm($form);?> return errors. This is what I found in $node:

I may have missed it. I tried using the ID path in the unset form function but it didn't work. This is what I'm putting in template.php:

function fivestar_form_fivestar_custom_widget_alter($form, &$form_state) {
  unset($form['field_funny']['#ajax']['progress']['message']);
}

I also tried theme_fivestar_form . . .


texts: Facet API - Rewrite facet items via callback function

texts:
I'm trying to rewrite the link text in an Apache Solr facet block, specifically the one to drill down by bundle/content type. By default the block displays the human readable name of the content type. I want to avoid simply editing the name as this would affect other things in the site.

So, in the block I would rather have a custom text such as 'Music Videos' rather than 'Article' from the 'article' content type.

I hoped to use the hooks created by Facet API Bonus to rewrite facet items via callback function, but am having difficulty getting the code to work.

Here is what I have, based on material from here and in the Facet API Bonus module readme:

function custom_module_facet_items_alter(&$build, &$settings)
 {
  if ($settings->facet == "apachesolr@solr:block:bundle") {
   {
    foreach ($build as $key => $item)
     {
      switch ($key)
      {
        case 'article':
          $build['article']['#markup'] = 'Music Videos';
          break;
      }
     }
   }
 }

I'm using Drupal 7.27, Facet API 7.x-1.5 and Facet API Bonus 7.x-1.1 .

Thanks in advance for any help.


texts: How do I turn off full html in comments only in drupal 7

texts: Okay, I have set all content editing for admins on full html in drupal 7. I have also enabled wysiwyg and ckeditor. All is good, except I just want plain text and no ckeditor for the comments sections but want to allow automatic converting of links on it. How do I fix this? thanks guys.


texts: Search has disappeared on Drupal Commerce Kickstart site

texts: When I first installed Drupal Commerce Kickstart it had a search enabled in the 'User Bar First' region. Now for some reason it has disappeared and I can't find it anywhere. I have tried searching the blocks and checking the search settings. What has happened to it?


texts: Required Fields with unlimited field collection items

texts:
I have a D7 instance with a field collection called field_professions and associated to a content type with "unlimited" amounts of fields. Within this field collection I have two fields that are required (field_professional_user and field_professions). I also have an unrequired field called field_serving_since. For the sake of testing I made the entire field collection required.

Now, when I have an item entered, I can enter a 2nd, 3rd etc. item, but whether I fill out all 3 fields, 1 of the required fields, or the unrequired and none of the required fields, it never validates that the fields are required. I can obviously see the red asterisk, but there is no validation.


texts: bankID as a key for storing purpose for Select option in Drupal form API

texts:
I've created a drupal custom form. I've used a select option for bank which get its value from the bank table. I want to store bankID in bankbranch table and which is a foreign key and display bank name in select box but it shows me an error:

  Undefined property: stdClass::$bankID in bankbranch_form() (line 40 of
  C:\wamp\www\emp\sites\all\modules\bankbranch\bankbranch.module).

/**
* Implements hook_permission().
*/
function bankbranch_permission() {
  return array(
    'submit bankbranch' => array(
      'title' => t('submit bank branch'),
      'description' => t('submit bank branch form'),
    ),
  );
}

/**
* Implements hook_menu().
*/
function bankbranch_menu(){
  $items = array();
  $items['bankbranch'] = array(
    'title' => 'Bank Branch Entry Form',
    'type' => MENU_NORMAL_ITEM,
    'access arguments' => array('submit bankbranch'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('bankbranch_form'),
  );
  return $items;
}

/**
* Bank Branch Form
*/
function bankbranch_form($form, &$form_state){
  $query_bank = db_select('bank', 's')
    -> fields('s', array('bankID', 'bankname'))
    -> execute()
    -> fetchAll();
  $options_bank = array();
  foreach($query_bank as $value) {
    //bankID as key
    $options_bank[$value->bankID] = t($value->bankname); /** line for which it shows notice*/
  }
  $form['bankID'] = array(
    '#type' => 'select',
    '#title' => t('Select Bank Name'),
    '#options' => $options_bank,
    '#size' => 1,
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['branchName'] = array(
    '#type' => 'textfield',
    '#title' => t('Branch Name'),
    '#size' => 50,
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['branchaddress'] = array(
    '#type' => 'textfield',
    '#title' => t('Branch Address'),
    '#size' => 50,
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['branchcode'] = array(
    '#type' => 'textfield',
    '#title' => t('Branch Code'),
    '#size' => 50,
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['ifsccode'] = array(
    '#type' => 'textfield',
    '#title' => t('Branch IFSC code'),
    '#size' => 50,
    '#maxlength' => 128,
    '#required' => TRUE,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add item'),
  );
  return $form;
}

/**
* Submit handler for the bank_form. Insert entry into the database.
*/
function bankbranch_form_submit($form, &$form_state){
  $branchID = db_insert('bankbranch')
    ->fields(array(
      'bankID' => $form_state['values']['bankID'],
      'brachName' => $form_state['values']['brachName'],
      'branchaddress' => $form_state['values']['branchaddress'],
      'branchcode' => $form_state['values']['branchcode'],
      'ifsccode' => $form_state['values']['ifsccode'],
    ))
    ->execute();
    drupal_set_message(t('Your form entry has been added'));
}

Any suggestions?


texts: What am I doing wrong? Trying to join two fields from two tables, Drupal 7

texts:
Based on this tutorial I created a module to be able to find first name or lastname from user fields. Everything is working fine, but I notice that the search only looks either for name and last name and not both. Could you please help me to modify the following code to be able to look for both first name and last name? Unfortunately I am not a pro in databases, I know just the basics... I would really appreciate any answer.
Thanks.

function custom_extend_user_search_search_execute($keys = NULL, $conditions = NULL) {

   $find = array();
  // Replace wildcards with MySQL/PostgreSQL wildcards.
  $keys = preg_replace('!\*+!', '%', $keys);
  $query = db_select('users', 'u')->extend('PagerDefault');
  $query->distinct();
  $query->fields('u', array('uid'));

  // Additional tables
  $query->join('field_data_field_name_first', 'fn', 'fn.entity_id = u.uid');
  $query->join('field_data_field_name_last', 'ln', 'ln.entity_id = u.uid');

  $query->fields('u', array('mail'));
  $query->condition(
    db_or()
      ->condition('u.name', '%' . db_like($keys) . '%', 'LIKE')
      ->condition('u.mail', '%' . db_like($keys) . '%', 'LIKE')

      // Additional fields
      ->condition('field_name_first_value', '%' . db_like($keys) . '%', 'LIKE')
      ->condition('field_name_last_value', '%' . db_like($keys) . '%', 'LIKE')
  );

  $uids = $query->limit(15)->execute()->fetchCol();
  $accounts = user_load_multiple($uids);

  $results = array();
  foreach ($accounts as $account) {
    $result = array(
      'title' => format_username($account),
      'link' => url('user/' . $account->uid, array('absolute' => TRUE)),
    );
    if (user_access('administer users')) {
      $result['title'] .= ' (' . $account->mail . ')';
    }
    $results[] = $result;
  }

  return $results;
}


texts: Migrating taxonomy terms when source is a separate table?

texts:
I'm writing a migrator for a now-unsupported WordPress plugin that used a single "attachments" table to store data ranging from thumbnails to musical genres. It looks like this:

mysql> describe attachment;
+----------------------+--------------+------+-----+---------+----------------+
| Field                | Type         | Null | Key | Default | Extra          |
+----------------------+--------------+------+-----+---------+----------------+
| attachment_id        | mediumint(7) | NO   | PRI | NULL    | auto_increment |
| attachment_target    | varchar(32)  | YES  |     | NULL    |                |
| attachment_target_id | mediumint(7) | YES  |     | 0       |                |
| attachment_type      | varchar(32)  | YES  |     | NULL    |                |
| attachment_info      | text         | YES  |     | NULL    |                |
+----------------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

attachment_id is just an ID, attachment_target_id will correspond to a NID from the "artist" content type I'm trying to import this into, attachment_type is either "genre" or "thumbnail" and attachment_info is the actual data contained in the row ("Disco", as an example for a genre.).

To import all the genres into a taxonomy field, it seems I would extend the class that imports all the artists from the other table, then using $this->systemOfRecord = Migration::DESTINATION, import each row into the existing nodes. Alas, given each row would be a new migration item, it seems this would overwrite the values.

I've also thought about adding a sub-query to my initial artist migration that returns a comma-separated list of genres; alas, I'm not sure how I'd do that with Drupal database abstraction layer.

Any help? Thanks!


texts: Loop through entities chosen by Views Bulk Operations

texts:
I successfully created a new action using hook_action_info() and a corresponding hook_action(). However, I want to find the method which loops through the elements chosen by Views Bulk Operations, as I wanted to combine some pages for a pdf.

What method loops through the entities chosen by VBO?


texts:
for example for the file node.html.twig has a giant comment saying

* Available variables:
* - node: Full node entity.
 *   - id: The node ID.
 *   - bundle: The type of the node, for example, "page" or "article".
 *   - authorid: The user ID of the node author.
 *   - createdtime: Formatted creation date. Preprocess functions can
 *     reformat it by calling format_date() with the desired parameters on
 *     $variables['node']->getCreatedTime().
 * - label: The title of the node.
 * - content: All node items. Use {{ content }} to print them all,
 *   or print a subset such as {{ content.field_example }}. Use
 *   {{ content|without('field_example') }} to temporarily suppress the printing
 *   of a given child element.
 * - author_picture: The node author user entity, rendered using the "compact"
 *   view mode.
 * - metadata: Metadata for this node.
 * - date: Themed creation date field.
 * - author_name: Themed author name field.
 * - url: Direct URL of the current node.
 * - display_submitted: Whether submission information should be displayed.
 * - attributes: HTML attributes for the containing element.
 *   The attributes.class element may contain one or more of the following
 *   classes:
 *   - node: The current template type (also known as a "theming hook").
 *   - node--type-[type]: The current node type. For example, if the node is an
 *     "Article" it would result in "node--type-article". Note that the machine
 *     name will often be in a short form of the human readable label.
 *   - node--view-mode-[view_mode]: The View Mode of the node; for example, a
 *     teaser would result in: "node--view-mode-teaser", and
 *     full: "node--view-mode-full".
 *   The following are controlled through the node publishing options.
 *   - node--promoted: Appears on nodes promoted to the front page.
 *   - node--sticky: Appears on nodes ordered above other non-sticky nodes in
 *     teaser listings.
 *   - node--unpublished: Appears on unpublished nodes visible only to site
 *     admins.
 * - title_attributes: Same as attributes, except applied to the main title
 *   tag that appears in the template.
 * - content_attributes: Same as attributes, except applied to the main
 *   content tag that appears in the template.
 * - author_attributes: Same as attributes, except applied to the author of
 *   the node tag that appears in the template.
 * - title_prefix: Additional output populated by modules, intended to be
 *   displayed in front of the main title tag that appears in the template.
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
 * - view_mode: View mode; for example, "teaser" or "full".
 * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
 * - page: Flag for the full page state. Will be true if view_mode is 'full'.
 * - readmore: Flag for more state. Will be true if the teaser content of the
 *   node cannot hold the main body content.
 * - logged_in: Flag for authenticated user status. Will be true when the
 *   current user is a logged-in member.
 * - is_admin: Flag for admin user status. Will be true when the current user
 *   is an administrator.

Where would these come from?

When I write my own template file how do I know what variables are available in my new template file?


texts: What are methods for tracking discussions or issues on Drupal.org

texts:
On Drupal.org, there are a number of discussions or issues that I subscribe to and wish to track. Do folks use any particular method to receive push updates or alerts when replies are added to threads?

Is typing in "subscribe" still the only method for tracking discussions?

I dislike having to "check" on webpages to be notified of updates. I'm more of an RSS and Google Reader tracker.


texts:
I am looking for a way to create new user Display.

When I go to Admin > Configuration > People > Acount Setting > Manage Dispaly

there are only three display modes: Default / Compact / User Account

How do I create a custom display mode?

See attached picture.


texts: Displaying image from referenced entity in a view

texts:
I am trying to create an image albums with the biblio content. These are the steps I have taken:

On the Biblio content type, I added a new field called Image of type Image
Created a new content called Album. Added one field of type Entity reference; and referenced, to the Biblio content, with multiple selection
This is where I'm stuck, creating a view for the albums. I'm not able to display the image content of the biblio entity reference. I have added a relationship to the entity reference: referencing the biblio entity. And added the field Content:Image with a relationship to the biblio entity.

I'm at loss, I know I have a big mistake in the view, but I'm not getting the big picture on how to relate.


texts: How to add classes to a specific bean w/ display suite template

texts:
On the website home page that I'm working on, we have 4 call-to-actions.

Below is the DS template file which is used when rendering each of them:

<?php

/**
* @file
* Display Suite 2 column template.
*/
?>

<<?php print $layout_wrapper; print $layout_attributes; ?> class="ds-2col <?php print $classes;?> cta-body clearfix" style="background: #<?php print $field_bg_colour[0]['value'] ?>">

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

<?php if (isset($field_more_link)): ?>
  <a href="<?php print $field_more_link[0]['url']; ?>">
<?php endif; ?>

  <<?php print $left_wrapper ?> class="group-left<?php print $left_classes; ?>">
    <?php print $left; ?>
  </<?php print $left_wrapper ?>>

  <<?php print $right_wrapper ?> class="group-right<?php print $right_classes; ?>">

<?php print $title ?>

      <?php print $right; ?>

  </<?php print $right_wrapper ?>>

<?php if (isset($field_more_link)): ?>

<?php endif; ?>

</<?php print $layout_wrapper ?>>

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

Currently I'm adding a margin-right to each of these, but would like to remove the margin-right on the even number call-to-actions - so my layout works.

Is there any way I can add an odd/even zebra class or a better way to do this?

Many thanks