texts:
Initial Question

Given an older CMS that kept data in a mysql database, how could we move this into a new D7 install?

It has a mysql database with a content table containing Title and Body (with HTML content) columns, could I do an import of this into Drupal and fill in the gaps as needed? I'm okay to rebuild menus and tie up other loose ends, but I'm fearing hours of cutting and pasting putting.

Follow Up and Outcome

:** After considering all the great advice below, I opened the older database in mysql Query Browser, executed a query on the profiles table to give me a CSV file with the following headers...

FirstName
MiddleName
LastName
Address1
Address2
phone
Email
title
cvFilePublic
pageContent
lastUpdateDate
pageName
pageURI
pageID

Then I created a Feed Importer with the following mapping:


texts: How to specify multiple submit handlers for multiple forms

texts:
I am implementing hook_forms in my custom module and I don't know how to have multiple form submit handlers.

Here is my custom form function:

function data_retrieval_main_form()
{
    $form ['field2'] = array(
        '#type' => 'textfield',
        '#title' => t('Name'),
        '#default_value' => $name,
        '#maxlength' => 127,
    );

    $form ['field3'] = array(
        '#type' => 'textfield',
        '#title' => t('Age'),
        '#default_value' => $age,
        '#maxlength' => 127,
    );

    $form['fileupload'] = array(
        '#title' => t('Choose Image'),
        '#type' => 'file',
    );

    $form ['submit_field'] = array(
        '#type' => 'submit',
        '#default_value' => 'Submit',
    );

    return $form;
}

Here I am implementing hook_forms:

 function hook_forms($form_id, $args) {

      $forms ['mymodule_first_form'] = array(
        'callback' => 'data_retrieval_main_form',
      );

      $forms ['mymodule_second_form'] = array(
        'callback' => 'mymodule_main_form',
        'callback arguments' => array('some parameter'),
      );

      return $forms;
    }

Now I previously had a single form using hook_form and the handler was simply like this:

function data_retrieval_form_submit($form_id, &$form_state)
{
// validation and submission of form
}

But now that I have multiple forms, how do I have multiple submit handlers for the forms, is there a way in Drupal that checks which form is being submitted?


texts: Avoid caching pages for authenticated users with Varnish

texts:
I have the following problem: when a user logs in and navigates through pages that he visited when was an anonymous user, he "sees" the cached page instead seeing the page version for logged users.
I'm using Varnish and I have tried the following code without result:

  if (req.http.Cookie) {
    set req.http.Cookie = ";" + req.http.Cookie;
    set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
    set req.http.Cookie = regsuball(req.http.Cookie, ";(SESS[a-z0-9]+|NO_CACHE)=", "; \1=");
    set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
    set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

    if (req.http.Cookie == "") {
      # If there are no remaining cookies, remove the cookie header. If there
      # aren't any cookie headers, Varnish's default behavior will be to cache
      # the page.
      unset req.http.Cookie;
    }
    else {
      # If there are any cookies left (a session or NO_CACHE cookie), do not
      # cache the page. Pass it on to Apache directly.
      return (pass);
    }
  }

How can avoid this issue?

Thanks


texts: Restore with backup & migrate module does not work with Acquia Dev Desktop

texts:
Having messed up my dev site (running on Win 7 using Acquia Dev Desktop), I restored a backup I took a few hours ago with the Backup & Migrate module. Now when I click the local site name in Acquia Dev Desktop I get a Choose Language message from Drupal instead of my site. I'm certain I had this problem a few months ago, but I apparently did not make good notes because I don't know where I found the instructions to fix this problem. My guess is that the $database parameters are wrong in settings.php or maybe there's some other problem.

Help is appreciated!


texts:
I'm using Drupal 7, Webform module, and Bootstrap Sub-Theme.

I'm facing a browser problem and an admin/end-user problem.

As a French speaker I would like to have my error messages in French.

In Safari (as admin), it shows errors in red box as in this example:

This is my result in Chrome (as admin):

And this is my result in Firefox (as anonymous):

Chrome (as admin) is working with translation automatically (as shown in the example above), but not Firefox (as end-user).

Safari and Chrome (as admin) use a different way to display errors.
Safari got red box for every errors.

Chrome uses a red box just for web form validation (module) errors.

I would like to have errors in French and in red box for end-user as well.

End-user have to answer a Captcha.

Any suggestions to resolve these issues?


texts:
I want to list (in a views block) only teasers of articles that are younger than the current node.

Somehow I have to use the current node from url->field_date for filtering. Is this possible with views via the UI (Contextual Settings)?

Or do I have to create a module for that? If so... which hook should I use.. how to tell the view to filter?


texts: How can I see the last 200 referrals in a Drupal 7 website?

texts:
I'd like to be able to see where the last 200 (or so) visitors to my drupal site came from. I understand that the global HTTP_REFERER variable is what I'll need, but I'm not sure how to proceed. I don't see a global variable in the API docs to help me with this. Any ideas?

If there is an existing module (surprising the me that I can't find one) that provides this functionality, I'm all ears. I have already set up google analytics, and I can see referrals from the GA dashboard. However, GA seems to aggregate referrals (it tells me that I had 1000 referrals from Facebook over the life of my site, for instance), whereas I want to see the specific referral for each visitor.


texts: How to hide text format options when using WYSIWIG module?

texts:
Using this tip I was previously hiding the text format options with

$form['und'][0]['format']['#access'] = FALSE;

When I enabled WYSIWYG it wouldn't show the editor and I had to use

$form['und'][0]['format']['format']['#access'] = FALSE;
$form['und'][0]['format']['guidelines']['#access'] = FALSE;
$form['und'][0]['format']['help']['#access'] = FALSE;

What's left now is this bottom box (below Path: p...)

This is the HTML that's generating it:

<fieldset class="filter-wrapper form-wrapper" id="edit-comment-body-und-0-format">

<input id="edit-comment-body-und-0-format--2" class="wysiwyg wysiwyg-processed" type="hidden" name="comment_body[und][0][format]" value="filtered_html">

</fieldset>

I could hide it with CSS. How would I hide it with code similar to above? Btw, I'm aware of Better Formats module but don't want to use it just for that.


texts: Why might form values not be passed from input to values?

texts:
Somewhere between buildForm and validateForm the $form_state's 'input' becomes the 'values'.  The values are listed as 'null'.  For some reason, some sort of validation from core seems to be preventing only SOME of my values to be left behind, and there's no reason I can come up with, because the data is identical.  Both are textfields representing URLs.  My form is kind of complicated, so I can't post it unfortunately.

I have a feeling the problem is involving ajax somehow.  The fields which are failing are fields which are added to the form by ajax.  Sometimes the values turn to null, and other times the values turn to an empty string.

Where should I look in core to figure out what validation might be getting mad at my fields?  Do you know of any typical thing that might prevent a user's input from passing to values?

EDIT: Here are the contents of my buildForm:

$items['redirect']['old'] = [
  '#type' => 'textfield',
  '#title' => t('Old'),
  '#default_value' => '',
  '#size' => 40,
  '#maxlength' => 502,
  '#description' => t('Old URL.'),
  '#required' => TRUE,
];

$items['redirect']['new'] = [
  '#type' => 'textfield',
  '#title' => t('New'),
  '#default_value' => '',
  '#size' => 40,
  '#maxlength' => 502,
  '#description' => t('Redirect URL.'),
  '#required' => TRUE,
];

$defs = $this->grabDefaultValues();

FormHelper::elementClone($form, $form_state, $items['redirect'], ['old'=>$defs['olds'],'new'=>$defs['news']]);

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'Submit',
);

return $form;

The FormHelper part is just some reusable code for cloning the two elements together, so I get old1, old2, old3, etc.  old1 always works, but old2 and old3 mess up sometimes.  The thing is, I have used this code before, and it worked, so I don't know what's happening in this case.


texts:
I would like to perform the following mass action via VBO: send a mail to author of a node.
This mail is configured and sent in a hook_entity_update function.
The beginning of the function is the following :
if (is_null($entity)) return;
if (!isset($entity)) return;

$nid = \Drupal::routeMatch()->getRawParameter('node');
if ($nid) {
 $type = $node->bundle();
 if ($type != 'membre') {
   return;
 }
}
else if ($nid == null) {
 return;
}

...

$mailManager->mail($module, $key, $to_trsf, $langcode, $params, NULL, $send);

test 1: If I update manually the node, the mail is sent.
test 2: If I update the node through a VBO, the mail is not sent because the nid is null, so the "return" statement is done.
Is there a possibility to retrieve the nid of a node when the hook is fired throught a VBO action?


texts: Why did my site crash when I moved module and theme folders?

texts:
A little background, I am quite new to Drupal and IT in general, so this may be a silly/basic question (I am going to start learning HTML, CSS, PHP, etc. for Drupal). I first set up my Drupal site by following the steps on drupalize.me, and then I installed the Sublime Text Editor 3. I realized I had already installed some contributed modules and the Bootstrap theme from drupal.org, but I didn't have contrib and custom folders for modules and themes, both. So I created them and moved the contributed module folders to the contrib folder under 'modules'. I also moved the contributed Bootstrap theme folder to the newly created contrib folder under themes. Then I tried to load my website but it said 'The website has encountered an unexpected error'.

What went wrong here and how can I move my already installed modules and themes correctly to their respective contrib folders?


texts:
I recently installed and enabled the Back To Top module. It gives a button at right bottom of the screen to scroll back to the top of the page.

How can I increase the scrolling speed?


texts: How do I set the custom upload directory for a plupload from field?

texts:
My module uses a plupload form field. I'm trying to define a custom directory for my plupload uploads.

A normal upload form for a managed file looks something like this:

$form['managed_file'] = array(
    '#title' => t('Managed file example'),
    '#type' => 'managed_file',
    '#upload_validators' => array(
        'file_validate_extensions' => array('jpeg jpg png gif'),
        'MODULENAME_validate_not_filename' => array('test.')),
    '#upload_location' => 'public://imagebank',
    '#progress_indicator' => 'bar',
    '#progress_message' => 'One moment while we save your file...',);

Plupload integrations module suggests using following code to integrate an Plupload form in a custom module:

$form['my_element'] = array(
    '#type' => 'plupload',
    '#title' => t('Upload files'),
    '#description' => t('This multi-upload widget uses Plupload library.'),
    '#upload_validators' => array(
    'file_validate_extensions' => array(
        'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'),
        'my_custom_file_validator' => array('some validation criteria'),
    ),
    '#plupload_settings' => array(
        'runtimes' => 'html5',
        'chunk_size' => '1mb',
    ),
);

In a managed file form there is this parameter to set upload location uri:

'#upload_location' => 'public://imagebank',

In the plupload form I see no such parameter.

I'm still learning custom module development so the answer might be obvious, but it isn't for me atleast. Could someone please point me in the right direction? The files should be uploaded to public://imagebank


texts: How can I create an excerpt for each of a node's taxonomy terms?

texts:
Rather than create a single node excerpt/ preview used across all Views for a taxonomy term, how can I create individual excerpts for a selection of taxonomy terms used to describe a node?

For example, if I have a node about a hotel that is family-friendly and has business facilities (both of which are also taxonomy terms), when I display a list of 'family-friendly' nodes I would like to display an excerpt with a short description of the family-friendly features of that hotel, whilst when displaying a list of nodes for hotels with 'business facilities', I would like to display excerpts with short descriptions of the business facilities at those hotels.

I've found the Excerpt module, but this only appears to provide a minor modification to how Drupal's existing excerpt feature works.


texts: I have lots of feature modules in my site. I want to import it back to database for upgrade purposes. Any idea how can I do that?


texts: Prev/Next on field group horizontal tabs

texts:
I'm using entityform and Field group to create a multi-step form, using Horizontal tabs.

I'd like the Prev/Next buttons, that show when you use Multipage, to show when using horizontal tabs.  i.e tabs + Prev/Next

I'd like pointers on how to go about coding it myself (if it's not currently configurable) as I don't know where to start.


texts: How to migrate multiple columns to single field in CSV Migrate

texts:
In my CSV file, I am having columns by name summary_1,summary_2 and summary_3. I want all of it migrated to a field in Drupal field_summary. The field supports multiple values.

id: sections_tfr
migration_tags:
  - CSV
migration_group: tfr
label: 'Import sections'
source:
  plugin: csv
  path: /var/www/html/php/tfr/prepared/final/sections.csv
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - s_id
  column_names:
    -
      s_id: Id
    -
      part_no: Part
    -
      sections: Section
    -
      summary_1: Summary
    -
      summary_2: Summary
    -
      summary_3: Summary

process:
  name: sections
  description: heading
  field_summary: summary_1
  field_summary: summary_2
  field_summary: summary_3
  weight: s_id
destination:
  plugin: 'entity:taxonomy_term'
  default_bundle: sections
  migration_dependencies: null


texts: I am wondering whether somebody has compiled a list of fields which are available for creating content types in Drupal. There are many lists of the most popular modules, but it would be great to have one focusing on existing fields, whether in core, or from third-party modules. I have looked around a bit, but always end up with lists of modules.


texts: Is there existing integration between the Salesforce and Location modules?

texts:
I'm using the Salesforce module in Drupal 7 and am attempting to create a mapping to one of my content types that contains a Location module field. After looking at both modules, I don't see an existing integration for them.

I tried adding a field mapping for just the street address (the only method available was using a token, so I selected [node:location:street]).  When I kick off the import of salesforce data, I get the following error:

WD Salesforce Pull: Unknown data property [node. Processing failed for entity XXXXXXXXXX
associated with Salesforce Object ID: XXXXXXXXXXXXX

I tried other variations of the token, too, including:

[node:location:street:0]

[node:location:street:?]

Both gave me the same error.


texts: Strange error in status reports en unable to safe my taxonomy term url-alias

texts:
When I go to admin/reports/status I see this error (see image).

Also I am unable to safe my taxonomy term url-alias? What does this error mean and how can I fix this?


texts:
How do I create a year-only drop-down field?

I want to create a Drupal 8 field that shows a year drop-down with 100 years to the current year.


texts:
I have previously made contextual filters for views that took a URL parameter and then filtered for related content and they worked great.

I now wish to make a view, that for a given node, lists all content that shares specific taxonomy terms from a specific vocabulary which the node is tagged with.

This should be easy but for whatever reason I am finding this ridiculously difficult. I seem to be able to either show all content or no content but not just the related content...

My general strategy has been to make a relationship to the taxonomy term on the node. Then create contextual filter in the taxonomy 'name'. Is this wrong?


texts: Is the homepage considered in_active_trail?

texts:
I'm learning Drupal 8, so still very new to it. I'm working on customizing the main menu. I've been able to add Twitter Bootstrap to my custom theme.  I've made a custom menu--main.html.twig file.

I'm trying to change the "is-active" class to "active" using what Drupal has available.  I see when I click to my About page that they About link is highlighted with the active link class.  Great!

What I can't seem to figure out is how do I get the Home page to get the active class too?  It looks like it is being treated differently.

I tried adding a new page called Homepage, but that didn't work either.

Here is my twig file, which i took pieces from another theme that use twitter bootstrap to try to compile it together.

{% import _self as menus %}

{#
  We call a macro which calls itself to render the full tree.
  @see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}

{% macro menu_links(items, attributes, menu_level) %}
  {% import _self as menus %}
  {% if items %}

    {% if menu_level == 0 %}

    {% else %}

    {% endif %}
    {% for item in items %}
    {%
      set classes = [
        menu_level ? 'dropdown-item' : 'nav-item',
        item.is_expanded ? 'menu-item--expanded',
        item.is_collapsed ? 'menu-item--collapsed',
        item.in_active_trail ? 'active',
        item.below ? 'dropdown',
      ]
    %}

      {%
          set link_classes = [
            not menu_level ? 'nav-link',
            item.in_active_trail ? 'active',
            item.below ? 'dropdown-toggle',
            item.url.getOption('attributes').class ? item.url.getOption('attributes').class | join(' '),
          ]
        %}
        {% if item.below %}
          {{ link(item.title, item.url, {'class': link_classes, 'data-toggle': 'dropdown', 'aria-expanded': 'false', 'aria-haspopup': 'true' }) }}
          {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
        {% else %}
          {{ link(item.title, item.url, {'class': link_classes}) }}
        {% endif %}

    {% endfor %}

  {% endif %}
{% endmacro %}

Update:  I went into Views in my admin panel and edited the Frontpage.  I noticed that it was not assigned to any menus.  I changed that by adding it to the main menu.  Looked at my homepage and the Home link is now highlighted as the active page.

So, what worked is adding it through the view page.  What did not work was adding the homepage from the "menu" screen where you build the menu. Clearly the homepage is treated differently from other pages in the menu and if you add it via the menu panel, it is not considered as part of in_active_trail.  I don't totally understand so I am hoping that someone can explain this to me.

Now, my question is did i do this right?

Update #3
I check my "Home" link in my main navigation.  The original "Home" link says "This link is provided by the Standard module. The title and path cannot be edited."  This link will not add the active class when I use "in_active_trail".

I had manually added a link via the Menu -> Main Navigation -> Add New Link.  I gave it a title called "Homepage" and the link "".  This link did not accept the "active" class either.

From what I can gather, the only way to get it to repsect "in_active_trail" is y using the Views -> Front page and then configure the menu setting.  That did the trick.


texts: D8 - Using Composer to download git repo

texts:
I want to download my libraries (/libraries) via composer.

Content of my composer.json:

 "repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    },
    {
        "type": "github",
        "url": "https://github.com/w8tcha/CKEditor-CodeMirror-Plugin.git"
    }
]

I call composer require "w8tcha/CKEditor-CodeMirror-Plugin":"*"

which tells me

Error -  The requested package w8tcha/ckeditor-codemirror-plugin could not be found in any version, there may be a typo in the package name.

What I am doing wrong?

Thanks


texts: Any way to alter script tag for some javascript and add custom attributes?

texts:
In order to work with Cloudflare's Rocket Loader service, certain scripts need to have their script tags updated with the cf-async="false" attribute like so:

<script type="text/javascript" cf-async="false">

Specifically, I need to add this attribute to the Drupal settings script tag, that gets added inline at the top of every page.

My first thought was to do this via hook_js_alter(), like:

function custom_helper_js_alter(&$javascript) {
  $javascript['settings']['cf-async'] = 'false';
}

But it doesn't seem to be possible to add custom attribute tags via this function. So my question is, is there any way at all to do what I want without hacking core?


texts: Remove "pubdate" attribute from Submitted Time tag in Drupal 7

texts:
Currently when a node or comment is submitted it gets a Submitted text saying "Submitted by user on Wed, 04/01/2015 - 18:07"

The mark-up for this is:

Submitted by *user* on <time pubdate="pubdate" datetime="2015-04-01T18:07:34+0000">Wed, 04/01/2015 - 18:07</time>

What I need to do is remove the "pubdate" attribute from the tag because the it is failing on W3C validation.

I have tried to add the following code in my template.php file but had no luck

function ThemeName_preprocess_node(&$variables) {
    $attributes['datetime'] = '<time'.drupal_attributes($attributes) .'>'.$variables['date'] . '</time>';
}

How can I remove the "pubdate" attribute in the Submitted by tag?


texts:
I've created an about us page on a Drupal 8 site that is a view displaying people on my site (in alphabetical order) that were generated from a custom member content type.

The page is basically a "Card" type look for each person in a 3 column grid.

What is the correct way to add an introductory block of text above this view listing? Is adding a custom block of text to the header portion the best way of doing this still? I can't seem to find any recent answers to this question. Is this easy for content editors to alter afterwords?


texts:
I have built a DYNAMIC VIEW to display city data, broken out as tabs on the page -- it is a modified verion of the taxonomy term page view.  It uses view menu tabs for this segregation, and Taxonomy Menu (of city names) to trigger the view.

The tabs all work correctly. The problem is the VIEW tab, which shows all results for the subject city (this is not a view display that I created). I don't want an "all results" tab, and I would like the Overview to be the active tab. However, it does not work to set the Overview as the default menu tab -- counterintuitive. (Have fiddled with this a lot! This year, and a project last year in D6.)  All the desired tabs are set as "menu tabs". The paths are of this format: taxonomy/term/%/travel/guide/overview

The so-called menu parent path (default tab) doesn't really exist. It appears that the default taxonomy term page behavior creates the VIEW tab. Have the Taxonomy Term Page view enabled also with different path than my city view:

I can hide the VIEW tab with CSS, but then there is no active tab.  Would like the Overview to be the active tab, hence first visual info.

NOTE: This issue is similar to this one (unresolved), but trickier because of taxonomy page behavior. Using Menu Tabs with Views 3 (Drupal 7)

  Confirmed. I have a similar issue: the default tab always seems to use the parent menu item's path, instead of its own. I guess, what we'd really like, is that the parent menu item required by default tab item, exist only virtually but never be used on its own. Gonna file an issue for that. – Artur Apr 21 at 9:24


texts: View with contextual filters and no value does not work

texts:
In a view I use a contextual filters with two fields: (category, subcategory)
When I build an URL with values on both fields i.e. /?q=gallery-details/Anciens/dessin&page=1 it works.

Idem if I give a value only on the first filter i.e. /?q=gallery-details/Anciens&page=1

But if I do not specify a value for the first filter and only one for the second filter, it does not work, even if it's configured to display all results when no value is specified in the URL. i.e. /?q=gallery-details//dessin&page=1

Do you know if there a way to do it work?


texts:
I have a vocabulary called category, another vocabulary called author and the content type is videos. I want to display all the authors(unique) by category vocabulary term?

Can any one please suggest me how to achieve this using views?


texts: New image field type for Articles only displaying on the article node itself, not on taxonomy or custom view pages

texts: I am having some issues with custom field content only displaying on the individual node. I have created a new field called field_second_image for the Article content type. I am calling it right under the regular field_image with print render($content['field_second_image']); in my node--article.tpl.php file. On the actual article node both images display properly. However, on a taxonomy list page or the custom article view page I have created, the second image does not show up. I think this relates to the general issue I've been having getting custom field content to display on pages other than the individual node page. Is there something I'm completely missing about getting this content to appear on other pages? Any help would be greatly appreciated, thank you.


texts:
I'm trying to use a jquery ticker in my website and this is the code: http://cektkp.com/twittermarquee/twitmarquee.js and I'm getting these errors:

1) Uncaught TypeError: Cannot call method 'extend' of undefined:

window.twttr.bounds = window.twttr.bounds || {};
   $.extend(twttr.bounds, {
      Bounds: function (b, d, c, a) {
        this.x = b;
        this.y = d;
        this.width = c;
        this.height = a
      }
});

2) Uncaught TypeError: Property '$' of object [object Object] is not a function (line 37)

 function loadTrendDescriptions() {
    $("#trends a").each(function () {
        var A = $(this);
        var C = A.parent().find("em");
        if (C.length) {
            var B = A.text();
            var D = C.text().replace(new RegExp(B.replace(/([^\w])/gi, "\\$1"), "gi"), "<strong>" + B + "</strong>");
            var E = A.attr("title").length ? A.attr("title") : A.attr("name");page.trendDescriptions[E] = [B, D]
        }
    })
}

I've fixed many other problems I was getting but these are the ones I just can't understand how to fix. Please help me out!


texts: How do I add javascript to a node or block

texts:
I've made a cost calculator script and want to use it on my Drupal 7 site.

I heard to use drupal_add_js, but I don't know in what context.


texts: When creating a content type I would like to have a field type that could be used to call a rest service or make a db call to an external database.  Does this exist?


texts: How do I ensure active menu items are highlighted for Views with Better Exposed Filter arguments

texts:
I'm using Better Exposed Filters on a clothing site. There are various types of products listed using Better Exposed Filters (to choose between Mens/Womens/Kids).

The Mens and Womens pages are variations on the same view.
The mens is at: /product-type/all?tid_3%5B%5D=1
The womens is at: /product-type/all?tid_3%5B%5D=2

This means that in each case the appropriate 'Better Exposed FIlter' checkbox is pre-selected.

The problem
Drupal treats both pages as the same address. Instead of making the "Womens" menu active items when on that page, it keeps the "Mens" menu item active.

How can I get around this, while ensuring that both "Mens" and "Womens" are the same view? I have already tried creating new URL aliases but Drupal does not allow me to do so for those URLS.


texts:
I'm currently building a system to create rapports for a set of possible units. So far I have built a set of content types in CCK that acts like templates where the templates fields are used to add structures that the users creating the rapport will fill out.

I have, in my template, a list of "key value names" that will then be added to the rapport and the user can fill them out.

The Template:
a, b, c

The rapport:
* a = x
* b = y
* c = z

where x,y,z is entered by the user generating the rapport.

I found this here on drupal.stackexchange.com and I guess it's on the right track. But I don't understand what I would fill in 'hooks' with and how to limit the action to only trigger on(/before) node creation. There is also a number of sub-nodes that needs to be created based on the templates, but that part I haven't research yet, if it is connected please include information about it in your answer if possible.


texts: How do I reorder page elements placed with Display Suite?

texts:
I want to change the stacking order of a certain page of a website of a client of mine. It's quite simple what I really want. You can check the screenshot. The website's current Drupal version is 7.59.

I want to move the category text section (the red section) beneath the section with the four category circles (the blue section), so that the section with the four category circles will be placed at the top.

Since I am a Drupal-beginner I could not find a good solution for it. You might think that this problem could be solved by using CSS by using display: flex and change the stacking order. The problem with display: flex that it moves the whole html view-mode-parent class including the title (Safety Showers). I want the title to be left alone and only the category text to be moved, but its not possible it's in the same html class (view-mode-parent).

This kind of page-template is used through out the whole website, as to be seen here: https://www.matcon.com/en

I noticed that the 2 sections are in a block, but that block is not listed at /admin/structure/block. I also couldn't find a view about it that is listed at admin/structure/views

I also checked all the options at "Manage display" but it does not contain the possibilities to do what I want. It only contains options for the specific sections (like the category text section or the category circles section) but not for the whole thing.

I got the impression that I maybe have to use some kind of hook in order to achieve my goal? If so, which hook should I use?


texts: Can I add the value of a field in a checkout pane to a completed order email?

texts: I would like to add a select list box to a checkout pane in drupal commerce that will allow me to use the selected value as a token to be added to the completed order email?


texts: What is the best way to run HTTPS for drupal commerce

texts:
I have seen the module Secure Pages, and also found Custom SSL redirect and read all the issues related to this and Commerce, but most seem out dated.

Can anyone say as of this point what is the best way to run the site on http and the checkout (anonymous users) with https?


texts: I want to disable the default theme in my Drupal 7.5 system installation instance. How can I do this? I can't find a Disable link using the Creative Responsive theme version 7.x-1.1.


texts: Expand +/- button for taxonomy display in a page

texts:
I've a taxonomy with years as its terms. It has some content within each terms. Now, I want to display the terms in a list like structure with a + as its suffix. So, when a user clicks the + button, the content within the terms will be displayed as expanded.

The taxonomy term list should appear as below

I'm using Drupal-7, tried to install Advanced book block module, but it works with drupal-6.

Thanks in advance..


texts: Reference three types of entities and render them in one list

texts:
I have this requirement, where a Node needs to reference instances of three different types of entities (a Node, a custom entity, and a webform). These three entities will then be rendered as one list of "related content".

Currently, I have them as three separate entity reference fields. But I could not figure out how to render them as a single list (it ends up being three lists of entities). Also tried the Dynamic Entity Reference module, but that one doesn't reference Config Entities (webform).

Am I missing an obvious way to achieve this?


texts: "White screen of death" on trying to open Flag edit form and Pathauto pattern page, error log points to includes directory

texts:
Ever since migrating the site, I have been unable to open the Flag edit form from the Flag module UI, as well as the "Patterns" page in the Pathauto interface. I checked the error log in my home folder on the server and these are the errors I see:

    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #0 /home/mysite/public_html/includes/database/database.inc(2168): PDOStatement->execute(Array), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #1 /home/mysite/public_html/includes/database/database.inc(680): DatabaseStatementBase->execute(Array, Array), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #2 /home/mysite/public_html/includes/database/database.inc(2347): DatabaseConnection->query('SELECT expire, ...', Array, Array), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #3 /home/mysite/public_html/includes/lock.inc(167): db_query('SELECT expire, ...', Array), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #4 /home/mysite/public_html/includes/lock.inc(146): lock_may_be_available('theme_registry:...'), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #5 /home/mysite/public_html/includes/theme.inc(449): lock_acquire('theme_registry:...'), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #6 /home/mysite/public_html/includes/bootstrap.inc(446): ThemeRegistry->set(Array), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #7 [internal function]: DrupalCacheArray->__destruct(), referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr: #8 {main}, referer: http://xxx.xxx.xxx.xxx/
    [Mon Feb 24 16:57:56 2014] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: stderr:   thrown in /home/mysite/public_html/includes/database/database.inc on line 2168, referer: http://xxx.xxx.xxx.xxx/

PHP version - 5.3.10
Memory allocated - 256M


texts: New language defined and set to default, original language on config translation still remains English

texts:
I have installed languages and set one of them as default, but still numerous things, for example Translations for User account menu block (admin/structure/block/manage/bartik_account_menu/translate) has English as original language. What can cause this?
This is an outdated version 8.9.11 which I'm not using in production, but I'm desperately trying to understand why this is happening on this installation, unlike on others where "original language" nicely becomes whatever has been set as the default language, as this is ruining my clever plans on exporting and importing some configs.


texts: How to programmatically print a webform block with caching enabled?

texts:
When displaying a Webform inside a normal block (using admin/structure/block) Drupal manage to correctly cache the page, the HTTP header displays X-Drupal-Dynamic-Cache: HIT.
However we need to display this webform inside a paragraph so we tried the following :

use twig_tweak module and {{ drupal_block('webform_...') }}
programmatically put the block in a template preprocess like this :

$my_form = \Drupal\webform\Entity\Webform::load('contact_new');
$output = \Drupal::entityManager()
          ->getViewBuilder('webform')
          ->view($my_form);
$variables['contact_form'] = $output;

Both solutions seem to make the page uncacheable: X-Drupal-Dynamic-Cache: UNCACHEABLE.
What would be the correct way to put a block in a paragraph while make the page cacheable ?
How to mimic the standard block system to display a in our template ?


texts: D2D file migration cannot processes a number of rows?

texts:
In my Drupal 6 site I have 147490 files in the database.  On my Drupal 7 site I am using D2D migrate module to import them.  The number of Items it sees is exactly the same, 147490.  However, it will not processes 5683 of them.  112229 import successfully and 29578 fail (because the file no longer exists on the server, that's fine).  When re-running the migration, it will not processes the remaining 5683.

Here is my migration class:

  $file_arguments = $common_arguments + array(
    'machine_name' => 'Files',
    'description' => t('Migration of files from Drupal 6'),
    'user_migration' => 'User',
    'default_uid' => 1,
    'source_dir' => 'http://lcl.legacy-d6.com/sites/default/files',
    'destination_dir' => 'public://',
  );

  Migration::registerMigration('Files', $file_arguments['machine_name'], $file_arguments);

I am then extending the class with an include: file_migration.inc

class Files extends DrupalFile6Migration {
  public function __construct(array $arguemnts) {
    parent::__construct($arguemnts);

  }

  public function prepareRow($row) {
    if (parent::prepareRow($row) === FALSE) {
      return FALSE;
    }

    $filepath  = $row->filepath;
    $new_filepath = str_replace('/var/www/html/liv-dir/production/', '', $filepath);
    $new_filepath = str_replace('/var/www/html/lcl.legacy-d6.com/htdocs/', '', $new_filepath);
    $row->filepath = $new_filepath;

    return TRUE;
  }

}

EDIT: I was able to create a snippet that finds all of the missing Ids however I was not able to figure out why they are not being processed.

    set_time_limit(0);
    $unprocessed_ids = array();
    db_set_active('legacy');
    $get_fids_query = Database::getConnection('legacy')->select('files', 'fi');
    $get_fids_query->fields('fi', array('fid'));
    $result = $get_fids_query->execute();
    while ($fid = $result->fetchField()) {
      db_set_active();
      $check_migration_query = Database::getConnection('default')->select('migrate_map_files', 'mfi');
      $check_migration_query->fields('mfi', array('sourceid1'));
      $check_migration_query->condition('sourceid1', $fid, '=');
      $check_migration_result = $check_migration_query->execute();
      $check_migration = $check_migration_result->fetchField();
      if ($check_migration === FALSE || is_null($check_migration) || !isset($check_migration)) {
        $unprocessed_ids[] = $fid;
      }
      db_set_active('legacy');
    }
  }

UPDATE: The only fix I could find that actually worked was waiting for the migration to run its course and then rollback a small number of rows, and then run through the migration again with --update flag set.  Depending on the envioronment I was running on (local vs pantheon) I would have to do this between 5-20 times.

I still want to know why this was happening.


texts: I have a view with three exposed filters like age, gender and city. Is it possible that, if I select for example "city = NY" and there are no "ages = 14-16" that this filter option will not be shown? I guess I want my exposed filters to narrow down each other (to work as a facet search). Is this possible?


texts: Disable user registration for certain pattern of: IP address, name, mail

texts:
I run a Drupal 7.10 / CentOS 6.2 website (where users can register after confirming their mail by clicking on a link) and there is a person registering at my site every night and then changing his name to obscene words.

First I've added a line to /etc/sysconfig/iptables to block his area:

-A INPUT -s 2.132.0.0/16 -j DROP

but this has blocked other users from that area (Alma-Ata city).

The pattern of this user is:

His IP address: strpos($_SERVER['REMOTE_ADDR'], '2.132.') === 0
His mail (changing every time): preg_match('/vlad.+@mail.ru/i', $mail)
His name (usually): stripos($name, 'st') !== FALSE

As you see - I have all the components there, I just need to know a good spot to put this code in. Anywhere to make his registration more difficult. An ideal case would be to sent  admin a mail for registration verification, but just bailing out of the registration script (which one is it please?) would be okay too.


texts: Installed Module crash my site. How do I bring my site back up by uninstalling a module

texts: I installed a module but it crashed my site and I can't get to the administrator backend anymore.  How do I disable this module to bring the site back up?


texts: If field date is 15 days away from today, change another field value

texts:
OK, this is specific:

I have a content type with two fields:

First is a expiration date field (d-m-y format);
Second is a select list field: "green, red, yellow, empty"

WHAT I NEED:

When there is 15 days left for the expiration date of a specific node, the select list field from that node should automatically change to "yellow".

Is this possible using, for example, rules module? Is there any other option?

Thank you!


texts:
I'm trying to get the answers from one form, pre-filled in another form by adding tokens in the confirmation URL. This works for most answers while using the token: [webform_submission:values:?]
However one of the answers I need to pre-fill is based on a content type (Entity select question), instead of sending just the node number of the content type, it sends 'node 101' (node%3A101) in the URL. I need the 'node%3A' part to disappear in order for the pre-fill to work.
This is how my confirmation URL looks like: /thank-you/?destination=[webform_submission:values:destination:raw]&e_mail=[webform_submission:values:e_mail]
The e-mail token works, the destination token not. If I leave the raw part out it will send both the destination name and the node in the URL, you will then get something like this: Sri%20Lanka%20%28101%29. The node of this content type (Sri Lanka) is 101.


texts: Rule should not fire when user logs in with one-time-link from password recovery

texts:
I have a rule for user-login that redirects them to their content area and shows a welcome message with some instructions. But when a user uses the password recovery mechanism that rule should not fire. I have tried "path has URL alias" and "user/reset/*" as value. But it did not work. I can't figure out what else i could use.

Reason is: users need their current password, which they don't know, when they are going manually to their user/n/edit page. When the rule wouldn't fire they'd be redirected to the correct password reset page without the current password requirement.

Thanks!


texts: Complicated Views query relationships (for me)

texts:
So here is what I am trying to figure out how to do. I have a content type of Users and I have a content type of User Programs (Outreach Program, Coaching Program, AA Program, etc) these are being linked by the Entity Reference module as a field on the User content type.

So when I am editing a User, I select the different programs that user is linked to (via the Entity Reference Module). The User Programs content type has taxonomy for the different program categories (Central Sector, North Sector, Western Sector, etc) and you can select multiple categories on the User Programs Node.

What I want to do in Views is this:

 Contextual filter: (User NID) = 40

 User: John Doe

 Programs Related to User --

   Central Sector (Taxonomy) -
     Outreach Program

   North Sector (Taxonomy) -
     Coaching Program
     AA Program

I know how to do simple views, but this one is starting to go out of my comfort zone, and I am getting kind of confused on how I could do something like this. I've tried an EVA view, but I am not too sure if that's what I am supposed to use. Any help would be greatly appreciated!

TIA!


texts: Unable to create multi-site sub-directory in drupal

texts:
I need help creating multi-site sub-directory in drupal. I have done all setting changes in localhost windows wamp server don't know what is missing.

let say, mysite is a main site and project1, project2 sub directory. Sharing same code base but different database.

In hosts file i have done the changes like this.

127.0.0.1 project1
127.0.0.1 project2

created project1 and project2 folder under sites folder and added setting files

     DocumentRoot "C:/wamp/www/mysite"
     ServerName project1

Its working fine for http:// localhost/mysite/ and http:// project1/,http:// project2.

But I want to show it in sub-directory like http:// localhost/mysite/project1 or http:// localhost/mysite/project2.

I have tried with doing Apache alias as well and it is point to relevant DB also but when I clicked any links from http:// localhost/mysite/project1 it will show an error message.


texts: After updating existing content How to get a token node:comment for actions?

texts: It was tried to change a term on a comment after updating existing content but there is no way to find the available token node:comment. Is there a possibility to have it?


texts: How to unsubscribe from issues on drupal.org to not see the updates in my dashboard?

texts:
I visit My dashboard to see answers on my issues. This is comfortable.

I've been typed comments in other issues and got the answer, but now I receive the info about new comments on those issues that I do not want to look. I get the "updated" tag on them.

How to kick those issues from My Dashboard https://www.drupal.org/dashboard?


texts: Locked myself out after enabling misconfigured Google Authenticator

texts:
I somehow managed to lock myself out of a Drupal 9 installation after setting up TFA with Google Authenticator login. So, i know my user1 name, my user 1 password, but TFA doesn't allow me backend access, because the app is misconfigured. I still have FTP, DB and SSH access.
I already did this two years ago on another site. That time I added a line to settings.php that granted admin role to anonymous user. But I cannot find this solution anymore.
Any help would make my day!


texts: Is there a module that enables users to follow each others?

texts:
Is there module that can
" Let users follow each others and be informed via mail in case of new items were added "
?


texts:
I'm currently working on a project with a new requirement that, in a nutshell, queues submissions from users and submits them them to a remote API:

collects submissions from users (with a form)
each submission points to a record on a remote system (uuid provided by remote API)
each submission has a status (ie: new, accepted, declined)
each submission stores a number of other fields of data
each submission references a node id that already exists in drupal
submissions with a status of "new" are presented to an administrator, who can accept or decline them (the queue)
changes to submissions are audited
submissions are never published as content, as they may contain personal info

Much of the data being stored for each submission is simply for interaction with the remote API. Only a small amount of the data for each submission is for human/administrator eyeballs.

I began architecting the storage for these submissions - basically just a really wide database table with one column that references a node id. The database table will also need to be exposed in Views, so that I can easily build pagable, filterable & sortable html tables. Will also perform some custom bulk operations (View Bulk Operations).

I'm now debating if it would be wiser to use a custom node type with a pile of CCK fields to store these submissions as unpublished nodes, rather than building it all custom. On the downside, I'd have to do a lot of form_altering to get the submissions form to where I want it, and I really don't need a lot of node functionality (workflow, comments, titles, etc, etc). On the plus side, if using nodes+cck the Views integration comes for free, and it's likely quicker to build.

I'm working in Drupal 6, and an upgrade to Drupal 7 is at least a year out - but it's also something I need to consider when making this decision.

Any thoughts?


texts:
function variable_get($name, $default = NULL) {
  global $conf;

  return isset($conf[$name]) ? $conf[$name] : $default;
}

From where does variable_get() get the first parameter?


texts: How do I store the input value on form submission?

texts:
I made a simple form in a module with a textfield and a submit button. Every time I type something into the textfield and submit, when the page loads, the default value is in the textfield. I followed the tutorial on http://www.badzilla.co.uk/Drupal-7-Tutorial--Form-Block-With-Template-File

Every #value property is set to whatever I type into the textfield under $form and $form_state except #default_value.

What am I missing?

Here is the code

<?php

function my_form_block_info() {
  $block = array();

  $block['my_form_block'] = array(
    'info' => t('My Form'),
    'weight' => 0
    );
    return $block;
}

function my_form_block_view($delta) {
  $block = array();
  switch ($delta) {
    case 'my_form_block':
      $block['title'] = t('Sample form in block');
      $block['content'] = drupal_get_form('my_form_form');
      break;
  }
  return $block;
}

function my_form_form($form, &$form_state) {
  $form['name'] = array(
    '#title' => t('Name'),
    '#type' => 'textfield',
    '#default_value' => 'some default value',

  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('submit'),
    '#validate' => array('my_form_validate'),
    '#submit' => array('my_form_submit'),
  );

  $form['#theme'][] = 'my_form';
  return $form;
}

function my_form_validate($form, &$form_state) {

return TRUE;
}

function my_form_submit($form, &$form_state) {

    drupal_set_message(t('Hello :name - how are you?', array(':name' => $form_state['values']['name'])));

    $input = $form_state['input']['name'];
    $form_state['values']['name'] = $input;
}

function my_form_theme() {

    return array(
        'my_form_form' => array(
            'arguments' => array('form' => NULL),
            'render element' => 'form',
            'template' => 'my_form',
        ),
    );
}


texts: How do I add a class to local task links in Twig template?

texts:
I've used custom templates to add BEM style classes to both the local tasks UL wrapper and the individual LI items, I'd like to also add a class to the actual local task (tab) link.

This is the default code in the Classy template:

<li{{ attributes.addClass(is_active ? 'is-active') }}>{{ link }}</li>

Is there no way to simply add a class to the {{ link }} item?


texts: How to create a sequence of nodes to work as a "tour" through a site?

texts:
I can think of different ways, like creating a View with all nodes available and sort them with DraggableViews so I have a tree, and then adding a Next/Prev buttons if the user wants to see the site not as individual nodes, but as a Tour, being taken from the first node to the last one in a specific order.

Anyone has any better, less of a hassle, ideas?


texts: Add a content type as a select list when creating a new user

texts:
I have a content type called Location.

Each user needs a location assigned to them.

How do I go about attaching the Location to the user?

Basically I need to add a dropdown of locations that I can select from for each user I create/edit.


texts:
I have installed Danland Theme and it is cool. I want the superfish menu to be appeared on few pages, not all the pages. For example if I type a wrong URL address in the address bar, it says Page not found and it still gives that Superfish menu there on the page.

I have some pages, where I don't want that superfish menu to be appeared.

Can anyone help?


texts: Trigger ajax callback from input field webform

texts:
I have a form build with the webform module. When text is entered in the input box in this case webform component 2 I want it to execute a ajax function and put data in a div. However this is not working at the moment. When i connect the ajax to $form['actions']['submit'] it does work.But i want it to be stuck to the input box not the submit function. The function is placed in the hook_form_alter.

$form['#node']->webform['components'][2]['#ajax'] = array(
  'callback' => 'callback function',
  'wrapper' => '#foo',
  'method' => 'replace',
  'effect' => 'fade',
);


texts: How to open a popup form from a view link?

texts:
I'm really struggling with this issue.
Well I'm having a view, in this view a field configured as personalized text as a link.
I want to open a popup form on click on the link.
Here is what I did in the method called by the link:

 $response = new AjaxResponse();
  $title = 'Title for the Popup.';
  $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
  $response->setAttachments($form['#attached']);
  $content = '
' . 'Content in HTML format' . '
';
  $options = array(
    'dialogClass' => 'popup-dialog-class',
    'width' => '75%',
  );
  $modal = new OpenModalDialogCommand($title, $content, $options);
  $response->addCommand($modal);
  return $response;

But It's not working at all!
Please help!


texts: Custom module wiped out all content of type

texts:
I've recently written a custom module for my site that deletes nodes older than two years whenever cron runs. It worked perfectly!

However a few weeks later, after updating Drupal 8 to 8.1.10, all the nodes of type "recent" were deleted! I don't know if it is connected to the module or not, but I have a hunch that it is.

Here is the .module file:

<?php

function delete_old_nodes_cron() {

        $node = $variables['node'];

        $query = \Drupal::entityQuery('node')
        ->condition('created', strtotime('-2 year'), '<=')
        ->condition('type', 'recent');
        $nids = $query->execute();
        foreach ($nids as $nid) {
            $node = node_load($nid);
            $node->delete();
        }
}
?>

and the .info.yml file:

name: Delete old nodes
description: Deletes nodes older than 2 years.
package: Custom
type: module
version: 1.0
core: 8.x


texts:
i have an issue concerning the API migration.
I have an existing drupal 7 website with a MySQL database.
Now i want to migrate this website in a new drupal 8 instalation with a postgreSQL database.
With a drupal 8 postgreSql, i can't execute the drush commande "migrate-status" or other :

while with exactly the same module and config, simply changing the BDD by a mySql one, i have access to these commands :

Does the migration modules are compatible with a postgresSql drupal ?
Regards


texts: Is it possible to hide fields on node edit form? I've tried Formatter Field but it doesn't work for me. I know it's possible in content type field display management but I need this functionality on node edit form.


texts: Non-admin user gets empty results when viewing other user data with views

texts:
I've been searching around now quite a while and couldn't find a solution that worked for me. So, here's my question:

I created a View that basically just a list of all users on my page. The view displays the

User name,
Taxonomy term and
User location.

For admin members the view works fine, but for non admins only the location is displayed, name and taxonomy give no results.

And,

I checked the permissions. The user is allowed to view other user profiles. He's allowed to view published content.
Changing the query settings of the view didn't work

Thanks for your help.

UPDATE:
In the process of elimination I checked/unchecked every single permission. The result: When I give the user the permission to Administer Organic groups permissions the user can see all the fields in the view. But I cannot allow a non admin user to administer og permissions. Any ideas why this is somehow connectd to user information fields?


texts: what is starting point of any drupal module.?

texts: Only beginner can ask this type of question. as i am learning drupal recently. what is the first function that executes in .module file..how can i understand which function or hook executed.I just want to analyse the execution..please help me out.


texts: How to print/render nested Paragraph values to twig template?

texts:
I'm trying to figure out how I can render values from nested Paragraphs. Basically I have field/values from a Paragraph within a Paragraph I have tried experimenting and searching for answers but I can't seem display the values from the nested Paragraphs to the twig template.

Here is the sample of the code below that I have been working on

First Paragraph
{% for paragraph in node.field_sidebar_area %}

{{ paragraph.entity.field_label.value }}

        {% for block_query in paragraph.entity.field_block_query  %}

            {{ block_query.entity.body.value | raw }}

        {% endfor %}

         {% for link in paragraph.entity.field_link_item %}

{{ link.url }}

{{ link.title }}

         {% endfor %}

    Second Paragraph
    {% for object in paragraph.node.field_sidebar_content %}

        {{ object.entity.field_label.value }}

    {% endfor }

{% endfor %}


texts:
I have a field that concatenates multiple taxonomomy terms  into a single text field. I have altered the existing module concat_field.

This all works fine but I cannot get search API to recognize the field (it worked with an older version of search api)

I have added this to the module:

function concat_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];

  $property['type'] ='text'; //tried concat_field as well which is the type in concat_field_field_info
  $property['getter callback'] = 'entity_metadata_field_verbatim_get';
  $property['setter callback'] = 'entity_metadata_field_verbatim_set';
  $property['label'] = 'Concat field';
  $property['description'] = 'concatenated field';
  unset($property['query callback']);
}

Any clue what i am doing wrong?


texts:
Similar to Drupal Answers, I'm creating nodes that are questions. Once I create a question node, I want to have it flagged as 'unanswered' if a user doesn't flag it as 'answered' within 10 days. I have Flags module setup so I can click 'answer/un-answer this question' on the node itself and Views displays the unanswered questions. I'm thinking that the Rules module will be of assistance here, but I do not see a way to start a timer (for lack of better words) in Rules once a node has been created.

Thank you.


texts:
Presenting price with comma separator is working. But while editing product (or creating) I have to use price with dot separation, otherwise I'm getting warning, that field doesn't contain value. So right now I have to remember to use dot and after I see common - it's annoying. Does anyone deal with this with success?

I want to enter 24,43 as value, but it is not recognizable as value (which actually is).

Instead I have to enter 24.43, which is not accessible from num pad with current regional settings.


texts: Show main menu in Foundation 6 Off canvas by loading a different twig template

texts:
How do I load my Primary menu in my Foundation Off canvas region off-canvas position-left?

In menu--main.html.twig I have below structure for my desktop menu:

      Griffioen

      {{ menus.menu_links(items, attributes, 0) }}

I hide it on mobile with the Foundation class show-for-small-only. But now it's hiding the main menu also in the off-canvas position-left.

Is there somehow a way to load another twig template from the main menu in the Off canvas region e.g. menu--off-canvas.html.twig? Then I am able to hide the desktop menu menu--main.html.twig and show the Off Canvas menu menu--off-canvas.html.twig?


texts: How do I make a link to a flagging edit page?

texts:
I'm using Drupal 8 with Flag 4.0-beta1.
On my flag, I have several fields. I want users to be able to edit these fields after making the flag.
How can I make a link to edit the flagging?
I tried various things in Views (making a view of flaggings; making a view of nodes with flaggings as a relationship), but I can't find a way to get an edit link to the flagging (to edit the fields on the flag itself).
NOTE: This question is about flaggings (an instance of a flag).  Here's the same question about flags.


texts: How to list all nodes of nodetype A which has the current node referenced?

texts:
So this is what I'm trying to do in Drupal 6:

Node type A is video, node type B is a person
Nodetype A has a reference field where you can enter a reference to any Node from nodetype B

how can I create a block view which will be displayed on nodes from node type b, which will show all the nodes from node type A where the current node from node type B is referenced?


texts:
I am trying to create an Infinite Scroll system to display past events on a page.
What I want is, when the top of the page is reached, I want to load past events.

I created the following JQuery:

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

            // div scroll event
            $('#events-list .content').on('scroll', function() {
                var pos = $(this).scrollTop();
                // if div reaches top
                if (pos == 0) {
                    // some ajax to load past events
                    console.log('top');
                }
             });
    }}
})(jQuery);

How would you do to load past events with AJAX using my code?
If anyone could give a hint to the right direction or a link to some documentation that would be awesome!

Thanks in advance.


texts:
I'm trying to submit JSON data directly to a webform through some restful resource. My thought was to create a webform, enable webform_service, and then post directly to the endpoint. This lead me to try something like this:

curl -vv -X POST -H "Content-Type: application/json" -d '{"title":"Contact Us", "submitted[contact_fullname]": "my name", "submitted[contact_email]": "test@example.com", "submitted[contact_message]": "test message"}' http://localhost/api/contact_us.json

But this does not work. In fact without the "title" value I get "title field is required", which seems to be trying to create a new webform, and in fact if I provide a title, a new webform is, in fact, created. But this is not what I'm looking to do - I'm trying to submit a new entry into the existing webform.

I thought that perhaps there's a different resource that I should be submitting form data to:

curl -vv -X POST -d 'submitted[contact_fullname]=sundartest&submitted[contact_email]=test@lp.com&submitted[contact_message]=test_message' http://ike.localhost/api/contact_emc.submission

But obviously this is wrong and I'm just guessing!

Any pointers on how I can accomplish this?


texts: How to set a text format to a views fields

texts:
If you add a content:body field to a view, you got several formatter options: default, plain text, trimmed, summary or trimmed. But is there a way to apply regular text filters?

I stumbled upon this while making an rss feed. Plain text formatter fails to remove brackets media module inserted into the article text.


texts: In Drupal 7, what is the proper syntax to call the theme function for a node, passing an argument?

texts:
I'm writing a Drupal 7 application that has many content types. Each of these content types has a custom template for display. For instance, I have node--event.tpl.php, node--person.tpl.php, node--feedback.tpl.php, and so on.

I'd like to be able to manually call a theme function on a node that should have an overriding template. i.e. something like the following:

<?php print theme('node', array('node' => $node)); ?>

The reason for this is that I've written a module called Content Inclusion which allows pieces of content to be manually included within one another. I'm trying to have this line of code in my node.tpl.php file to automatically display the included node along with the parent node.

I appreciate any and all suggestions, but I would be more interested in learning about ways to make this work - this module has some very specific requirements that existing modules were not able to address. Thanks.


texts: How to use hook_views_query_alter to add field with no table in Drupal 7 Views 3

texts:
I am new to Drupal 7/Views 3 hooks. I am trying to approximate this query:

SELECT *, 3956 * 2 * ASIN(SQRT(POWER(SIN(($postcode_lat - abs(lat))*pi()/180/2),2) + COS($postcode_lat * pi()/180) * COS(abs(lat) * pi()/180) * POWER(SIN(($postcode_lng - lng) * pi()/180/2),2))) AS distance
WHERE distance < 500
ORDER BY distance ASC

This gives a list of locations sorted by distance. However, in trying to implement with hooks, I am struggling. Here is the code that I tried:

$query->addField('', '3956 * 2 * ASIN(SQRT(POWER(SIN((32.7828 - abs(29.7631))*pi()/180/2),2) + COS(32.7828 * pi()/180) * COS(abs(29.7631) * pi()/180) * POWER(SIN((96.8039 - 95.2665) * pi()/180/2),2)))', 'distance');

Drupal doesn't like the empty parameter for table. But how can I add a field with no table?

I appreciate any suggestions offered.


texts: Webform element validation custom module

texts:
I want to add a custom validation to text input, I followed the instruction provided in
https://www.drupal.org/docs/8/modules/webform/webform-cookbook/how-to-add-custom-validation-to-a-webform-element

I have a requirement which needs to verify an id entered into a text box, by making a REST API call to another system, the issue  is to make that REST API call, I need another text parameter which is also inputed into the webform.
I have written a custom handler which makes that rest call, but that custom handler work on webform post save option only, how can I pass more than 2 fields to the validate function mentioned in the example given.

function onboarding_webform_element_alter(array &$element, FormStateInterface $form_state, array $context) {
    // check for desired element
   if (isset($element['#webform_id']) && $element['#webform_id'] === 'register_account--surname'){
     $surname= $element['#default_value'];
    $form_state->setValue('SOME_NAME', $surname);
   }
   if (isset($element['#webform_id']) && $element['#webform_id'] === 'register_account--proda_id') {

        $element['#element_validate'][] = array(
            'Drupal\dhs_vendor_onboarding\Validate\DhsValidateConstraint',
            'validate'
        );
    }
}

In the validate function:

public static function validate(array &$element, FormStateInterface $formState, array &$form) {
        ksm($formState->getValue('SOME_NAME'));
        $webformKey = $element['#webform_key'];
        $value = $formState->getValue($webformKey);
        $surname= $formState->getValue('SOME_NAME');
        }

I am not getting any value for surname


texts:
Conversation around: how to set content-security-policy header read and noted

https://www.drupal.org/project/csp (Drupal 8 only) mentioned unsafe-inline is mandatory for WYSIWYG edits to work.

My question is that when I use a standard Ajax form with CSP enabled to default, I get the following upon clicking the submit button.

"Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'" Either the 'unsafe-inline' keyword, a hash ([redacted]), or a nonce ('nonce-...') is required to enable inline execution."

How can I add either a hash or a nonce to Ajax forms?

Do all Drupal 7 websites require unsafe-inline for any WYSIWYG fields to work? Is that likely to be fixable?


texts:
I'm working on a Drupal 8 view that is going to be a page.

How can I make an exposed entity filter a dropdown? The entity is not a content type, but rather a custom entity with it's own module.

I can't seem to find any documentation about it.


texts: efficient way to apply content permissions

texts:
My site has content type "Department News". There are 10 departments, each one should have permission to create and edit its own "Department News", everybody can view everything.

How to implement it?

My idea is to create 10 roles - one for each department - and the only difference between them will be Create and Edit access to a specific content type.

Then create 10 identical content types, just named differently - and configure permission for the Department-Content matrix.

The question: is it possible to implement it somehow more efficiently, at least without creating 10 content types which are identical, only for the purpose of assigning permissions to them. Best would be also to get rid of the 10 roles and e.g. check additional permission for "Department News" based on a field in user profile.

Duplicating almost identical roles and content types is a burden from maintenance point of view.


texts:
I am working on a requirement to display a 2 column (question and answer ) view into flashcard .  question should appear on front and on flipping the answer should appear . I am not sure whether such kind of thing can be done with view , If there is any custom module that needs to be written , what should be the approach taken for such requirement.

Thanks for any pointer on this

Pks


texts:
I would like to add a menu link using the "Link"-Field with Autocomplete, but I would like to add a parameter afterwards.

Pretty much like this:

...which is not working.

Is that possible? Thanks!


texts: How would I add markup inside of page title input?

texts:
If I wanted to achieve the below, can I insert HTML markup inside of the page title on the node?

For example,

Dummy page title content


texts:
I know there is a post on how to set a view header/footer value here,
but how do I set a view header/footer without having to create it through views UI first?

The reason why I want to implement a view header programmatically is because (a) I want to write php code in it, by leveraging the Drupal's API, something that is not so convenient in a textarea field, like the one that the views UI provides -and any other textarea field- plus the fact that some functions may never get invoked and (b) because I want to conditionally set/unset the view header/footer.


texts: how to pull parent term from nested array?

texts:
I'm building a custom field and formatter in Drupal 8(and teaching myself how to use Drupal & PHP, so bear with me)

I'm not sure how to pull a parent term 'name' value from a nested array.

Right now, I've got this:

$tid = 15
$parent = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid);

But I'm not sure how to get the 'name' field so I can use it in my #markup.

I used var_dump to see what was there (can't use kint at the moment. Devel caused issues with some other modules)

Here's the array that came back:

array(1) {
[3]=> object(Drupal\taxonomy\Entity\Term)#1187 (26) {
    ["values":protected]=> array(9) {
        ["tid"]=> array(1) {
            ["x-default"]=> string(1) "3"
        }

        ["vid"]=> array(1) {
            ["x-default"]=> string(10) "plant_part"
        }

        ["uuid"]=> array(1) {
            ["x-default"]=> string(36) "2xxxxxx6-5xxb-2xx5-8xx7-axxxxxxxxc"
        }

        ["langcode"]=> array(1) {
            ["x-default"]=> string(2) "en"
        }

        ["name"]=> array(1) {
            ["x-default"]=> string(11) "Term wanted"
        }

I was trying something like this, but no luck:

 $parent['values']['tid']['x-default']


texts: How to export data from drupal to Excel?

texts:
I've inherited a Drupal site. I need to extract the main page data out of the site to be able to import it into a different system, but I've never used Drupal and the site is live so I need to tread carefully in order to extract the data without affecting the site.

Currently the website has lots of content pages for manufacturers. Each manufacturer has a name, description, some images and other (mainly text) data. Say, for example, there are 2000 of these manufacturers. What I'd really like to be able to do is export an Excel file (or XML file, whatever) so each field has a different column in the spreadsheet, and each drupal page (i.e. each manufacturer) is a different row in the export spreadsheet. Ideally the images will be exported as full URLs in a column in the spreadsheet.

When I log into Drupal and click the 'content' button at the top, it gives me a list of every page on the site. I can filter this to only show 'Manufacturer' pages. When I edit a specific manufacturer page it gives me a form containing all of the editable fields for that manufacturer, prepopulated with the data to edit. I just need this information for each manufacturer dumped out into a spreadsheet.

So as a complete Drupal noob, where would I start in doing this? Would I just go straight to the database and try to piece it together (if so, is the data stored in a single table, or will there be some major queries involved in doing this - any pointers about which tables to look at would be greatly received) or is there a tool for getting a bulk export of this kind of thing? I guess I could even create a web page which displayed this information in an HTML table and just scrape it from there, but ideally an export would be nice.


texts: Alter node menu local task weight of "View" and "Edit" for a content type

texts:
I want to alter the ordering of the node tabs for a particular content type.

From this: View, Edit
To this: Edit, View

I tried with using menu_local_tasks_alter like this:

function wedding_registry_menu_local_tasks_alter(&$data, $router_item, $root_path) {
      foreach ($router_item['page_arguments'] as $key => $argument) {
        if (is_object($argument) && $router_item['page_arguments'][$key]->type == 'my_wedding_registry') {
            dpm($data);
            foreach ($data['tabs'][0]['output'] as $key => $link) {
                if ($link['#link']['path'] == 'node/%/view') {
                    dpm($link['#link']['weight']);
                    $data['tabs'][0]['output'][$key]['#link']['weight'] = 5;
                    dpm($data['tabs'][0]['output'][$key]['#link']['weight']);
                }
                elseif ($link['#link']['path'] == 'node/%/edit') {
                    dpm($link['#link']['weight']);
                    $data['tabs'][0]['output'][$key]['#link']['weight'] = 4;
                    dpm($data['tabs'][0]['output'][$key]['#link']['weight']);
                }
            }
            dpm($data);
        }
      }
    }

Devel is showing the $data array correctly modified:

first with the default weights (View = -100, Edit = -99)
after with my modified weigths (View = 5, Edit = 4)

but the tabs on the page are still on the same positions even after clearing the cache!


texts: How to add a simple online payment transaction?

texts:
My client ask me to add a simple online transaction system to his drupal 7 site. Payment amount for his users are actually fixed for example 100$, 250$ and 350$. Also he wants link that transaction with his local bank and as optional he wants add the pay-pal also.

Could anyone please tell me how can I start to integrating this? I checked the drupal-ecommerce kicksart but I believe thats more advanced to this. However if anyone can instruct me to optimize it's requirement my client needs then it would be helpful.

I also checked Drupal https://drupal.org/project/simple_payments but since it's not supporting for the drupal 7 I've not much read on it.


texts: How do I link Drush to my Drupal site on Pantheon?

texts:
A friend of mine got me into Drupal and did the initial setup for me. At first, I was using localhost to play with Drupal and Drush to download and enable modules.

Now I have my own Pantheon hosting site that lets me install Drupal on their side, but how do I link my Drush command prompt to my online site? Before on localhost, it was just a matter of changing directories, but how do I connect it for a site online?

Edit: This is for Drupal 7.


texts:
Using drupal 7, Views 3, I have a function (present on Leaflet Module) which takes only 2 parameters. I use this hook function to print resulting points from view in different colors
//Allow modules to alter the points data while rendering a leaflet views row.
MY_MODULE_leaflet_views_alter_points_data_alter ($result, &$points)
{
  if (isset($result->number))
 {
  // Add number value to every points data entry, if present.
    array_walk($points, function(&$point, $key, $number) {
     $point['number'] = $number;
   }, $result->number);
 }
}

I am trying to use this hook to take variables from outside the function.
For example:
$data='heeeello';

MY_MODULE_leaflet_views_alter_points_data_alter ($result, &$points)
 {
  echo $data;
 }

Just returns NULL. Tried setting it up as Global (which should already be, but just in case), also variable_set($data,'hello')... no success.
Executing the function passing the params works neither:
MY_MODULE_leaflet_views_alter_points_data_alter ($result, &$points,$param)
{
  echo $param;
}

thanks in advance
EDIT
I want to populate an external array based on the data processed by my hook (see below MY_MODULE_leaflet_views_alter_points_data_alter)
This final array has to contain unique values. On standard PHP I would access the external array and populate recursively it but I have problems accessing this array via my hook.
Using global doesn't work, but it works using variable_set and variable_get, but it means that each time the hook access the variable (variable_get(param)), the array starts empty again.
$array = array();

variable_set('my_array', $array);

//testing global, doesnt work
$test=array();

MY_MODULE_leaflet_views_alter_points_data_alter ($result, &$points) {

    global $test;
    var_dump($test); //NULL

    $my_array= variable_get('my_array');
    //I will get allways an empty array... even if its later correctly populated

    //fetching results from the hook
    $name=$result->name;

    if (!in_array($name,$my_array))
      {
        array_push($my_array,$name);
      }

    //plots just a value (array is not recursively populated, as allways start empty inside the hook)
    var_dump($my_array);
 }


texts: View filtered by taxonomy term - is there a better way?

texts:
I am using Drupal 7.14 and I'm wrestling with filtering my content type based on taxonomy terms. I have a solution but I'm sure there must be a better way!

I have a content type called News. It has a taxonomy field so I can categorize the postings to it. I currently have 4 different taxonomy terms.

I also have a view that shows a page with all the News item teasers and links to the full article.

I have a menu on the side of the News page with links to each of the categories. Clicking on one of these links will show a page of teasers for that particular taxonomy term.

I have implemented the above as follows:
In my News view I have added a display page for each of the taxonomy terms. On the same form I changed the "Page Settings" to set the path to the path of the taxonomy term (this overrides the default taxonomy view for the term). I also change the "Filter Criteria" and add a filter for the particular taxonomy term.

I then built a menu using the taxonomy term paths and made it appear on the News content type pages. Each item in the menu points at its taxonomy term path. When the user clicks on a menu item it correctly shows the view filtered for that category. Note: it does not show the default taxonomy term page because I set the path to the taxonomy term in my view and this takes priority.

I have also overridden the template for my view by adding a custom template file called views-view-fields--news.tpl.php. This template is used for the full view and each of the filtered views.

The above does work but is there a better cleaner way? It is quite tedious to add a new category as I need to manually update the view to add a new display for the new category and I then need to update the menu of categories.

Many Thanks.


texts: How use geofield_openlayers in custom module

texts:
I'm writing a drupal custom module, in my form I need a geofield with openlayers map widget.
I can create a geofield_openlayer by using Content type, but I don't know how can I create the field in my custom module... which form type do I have to use?

This code don't works

$form['geofield_openlayers'] = array(
'#title' => 'geofield_openlayers',
'#type' => 'geofield_latlon',
);

Only geofield_bounds, geofield_proximity, geofield_latlon types works... but maps is not displayed.

Thank you.


texts:
I'm using ajax_links_api and every page is loading via ajax, except for the homepage. I can see response in "network" section of firebug, but it's not loading.

How can I debug that?

Thanks


texts: I am using Views 3. is it possible to have multiple taxonomy/term/% view? That's because i need different theme for every vocabulary


texts: How can I convert character entities to display as 'normal' characters in Drupal?

texts:
I have a customised module that imports items from feeds accessed via a third-party API. The items are used to create nodes for each instance. All the content appears to be importing correctly, but the feed includes character entities like '&amp' in some of the text imported. I've checked the CSVs being imported and the character entities are already in the feed content, so it isn't the module that's causing normal characters to be converted to character entities.

I'd like to know how I can get Drupal to convert the character entities to display as normal characters. Is there a module or setting that can do this?


texts:
How do I get rid of the outer box around the location field for example. I don't like how the location title + background colours are repeated twice for additional fields.

I have this issue on every template, not just the one displayed so can answers please be generic so I can do it on every template.


texts: Send node as HTML formatted email to all users of a role

texts:
I have a RULE that works well:

After saving a new content of type DEMO
Send node as HTML formatted email
Parameter: Send email to:doe@example.com,jane@test.com

What I need is to send the same Action but to a "users of a role", something like

After saving a new content of type DEMO
Send node as HTML formatted email
Parameter: Send email to: Roles: Editor ---Rules does not allow to add roles here---

Is there any module that can expand this function in RULES? Or is there some way to achieve this directly within RULES?
Thanks


texts: How do I add the "- Any -" option for the published status on exposed filters?

texts:
I need to add the - Any - option for the published status, on exposed filters.

I can't use it, as when I try to add it, I get the following error.

  You must select a value unless this is an non-required exposed filter.

How can I add - Any - as option?


texts:
Just updated a project to Drupal 7.63. Attempting to execute updb or other commands results in the following error:

PHP Fatal error:  Uncaught TYPO3\PharStreamWrapper\Exception: Unexpected file extension in "phar:///usr/local/bin/drush/commands/core/drupal" in /app/docroot/misc/typo3/drupal-security/PharExtensionInterceptor.php:38

What is the suggested fix for this?


texts:
I am use the Best Answer module. I customize the answer template, node-answer.tpl.php and I want to print best answer field,add

No output result, please help me.


texts: Drush update: How to keep file permissions?

texts:
Following scenario happens to be in place. There is a server administrator (root) who doesn't know a thing about Drupal. Then, there two (or more) web developers (userA, userB), who do not have root access but are all in the group "web".

The server has several Drupal instances which have to be updated on a regular basis. Each Drupal instance is set with permissions 2775 (dirs) or 2664 (files) and belongs to either userA or userB, group in all cases is web.

When using drush to update an instance, all files that are overwritten (due to updates) now belong to the user running drush and get the permissions 644 (instead of 664). Thus, when userA updates e.g. a module, this module can't be changed or updated by userB afterwards. userA always has to chmod the files after an update.

How can this be rendered unnecessary, or how can the file permissions be kept when using Drush?


texts: How to add a div tag after a specific field?

texts:
I have a view with four fields: title, body, poster, podcast.

I want to add a div tag after poster field. How can I do this?


texts: Change node configuration dashboard UI settings

texts:
While creating a node content Drupal 8 provides the following settings.

I want the URL path setting tab to be open by default.

I want to achieve it through the Drupal 8 backend customization settings (more preferable) or even Javascript/jQuery.


texts:
I would like to be able to search my views by a field that is generated by an Entity Reference of users of the site.

Attempt #1 - Combine Fields Filter
I added this filter as exposed with the setting of "Contains" either from the "Title" field or the "Responsible Party" field (which is the Entity Reference field that is a list of users.  Here is a picture of the settings
The results of this were that the title field is filterable as pictured here
Yet the user generated field did not properly filter as shown here

Attempt #2 - Search: Search Terms filter
Same process and same issues using this filter.  Here is a picture of the settings

Then the same results as shown here.
Searching Title
Searching Users


texts: AJAX populated filter breaks when Views Dependant Filter module added

texts:
I have a view with two exposed filters and I want to make the second filter dependant on the first in 2 ways

A user has to select an option from the first filter before the second is available to use. Achieved using Views Dependant Filters
The options within the second filter are dynamically updated so only combinations that will return results are presented. Achieved following this Views AJAX Dynamic Dependent Exposed Filters tutorial and creating a custom module.

I have an example of this view available on this development server.

Select an option from filter one and the second filter becomes available and it's options are updated as expected.

The problem occurs when you select a second different option from the first filter. The AJAX does not fire and the second filter options are not updated.

Code for updating filter two with AJAX is below, but I believe the problem lies on the client side.

I appreciate your suggestions.

function dependant_keyword_filter_form_views_exposed_form_alter(&$form, &$form_state){
    if ($form['#id'] == 'views-exposed-form-annotated-bibliography-page') {

        $form['#after_build'][] = '_sort_alphabetically';

        if(!empty($form_state['values'])) {
            $form_state['input'] = array_merge($form_state['input'], $form_state['values']);
        }

        $selectedCommodity = $form_state['input']['field_commodity_tid'];
        $form['field_keywords_tid']['#options'] = _get_associative_array_from_view(
            'annotated_bibliography_dependant_keywords', // view id
            'default', // view display id
            'taxonomy_term_data_field_data_field_keywords_tid', // key field id
            'taxonomy_term_data_field_data_field_keywords_name',
            $selectedCommodity // term id of the selected shape
            );
        $form['field_commodity_tid']['#ajax'] = array(
            'callback' => '_update_keywords_callback',
            'wrapper' => 'keywords_wrapper',
            );
        $form['field_commodity_tid']['#ajax']['progress']['type'] = 'throbber';
        $form['field_commodity_tid']['#ajax']['progress']['message'] = 'Updating keywords';
        $form['field_keywords_tid']['#prefix'] = '
';
        $form['field_keywords_tid']['#suffix'] = '
';
    }
}

function _sort_alphabetically($form, $form_state) {
        foreach ($form_state['view']->filter as $field => $filter) {
            if ($filter->options['exposed']  && $filter->options['id'] == 'field_keywords_tid' ) {
                $field_id = $form['#info']["filter-field_keywords_tid"]['value'];
                asort($form[$field_id]['#options']);
            }
        }
        return $form;
}

function _update_keywords_callback($form, $form_state) {
    return $form['field_keywords_tid'];
}

function _get_associative_array_from_view($viewID, $viewDisplayID, $keyFieldID, $valueFieldID, $contextualFilter){
    $associativeArray = array();
    $associativeArray['All'] = t('- Any -');
    $viewResults = views_get_view_result($viewID, $viewDisplayID, $contextualFilter);
    foreach($viewResults as $viewRow) {
        $associativeArray[$viewRow->$keyFieldID] = $viewRow->$valueFieldID;
    }
    return $associativeArray;
}


texts:
I have a custom form built that generates some fields based on a select box,
the form works ok on user side. it loads new rooms when select changes.
the problem is that the globallink_ui_search_hotels in form[values]['hotels']['rooms'] it will only show room_0 even if you select 2 or more rooms.

update:
 from what i can see the after number of rooms changes, the generated select boxes dose not have a name attribute

  function globallink_ui_search_form($form, &$form_submit){ // the form creation function
  //........
  $form['hotels']['nrrooms'] = array(
      '#multiple_toggle' => '1',
      '#type' => 'select',
      '#title'=>t('Number of rooms'),
      '#options' => array(
        1=>1,
        2=>2,
        3=>3,
        4=>4,
        5=>5,
        6=>6,
        ),
      '#default_value'=>1,
      '#ajax'=>array(
        'callback'=>'globallink_ui_rooms_change_callback',
        'wrapper'=>'globallink-ui-rooms-change-wrapper',
        'effect' => 'slide',
        ),
      // '#title' => t('select departing time'),
    );

    globallink_ui_rooms_change_callback($form,$form_state);

  //....
    $form['hotels']['submit'] = array(
      '#weight' => '7',
      '#type' => 'submit',
      '#value' => t('FIND HOTELS'),
      '#submit' => array('globallink_ui_search_hotels')
    );

  }

  function globallink_ui_rooms_change_callback(&$form,&$form_state){

    $nradults=array();
    for ($i=1; $i < 10; $i++) {
      $nradults[$i] = $i;
    }

     $form['hotels']['rooms'] = array(
        '#collapsed' => '0',
        '#type' => 'fieldset',
        '#collapsible' => '0',
        '#prefix' => '
',
        '#suffix' => '
',
    );

    $nrrooms=!empty($form_state['values']) ? $form_state['values']['hotels']['nrrooms'] : 1;

    for($i = 0 ; $i<$nrrooms;$i++){

      $form['hotels']['rooms']['room_'.$i] = array(
          '#weight' => $i,
          '#title'=>'Room '.($i+1),
          '#collapsed' => '0',
          '#type' => 'fieldset',
          '#collapsible' => '0',
      );

      $form['hotels']['rooms']['room_'.$i]['adults'] = array(
        '#required' => '1',
        '#default_value' => 1,
        '#type' => 'select',
        '#title'=>'Adults',
        '#options' => $nradults,
      );

      $form['hotels']['rooms']['room_'.$i]['infants'] = array(
        '#required' => '1',
        '#default_value' => 1,
        '#type' => 'select',
        '#title'=>'Infants',
        '#options' => $nradults,
      );
    }

    return $form['hotels']['rooms'];
  }

  function globallink_ui_search_hotels($form, &$form_state){
    dpm($form_state['values'],'search hotels');
  }


texts: how to add field_image widget (imagefield crop) to a custom form api

texts:
How can i add to my custom form api in my custom module the default widget from field_image?
I am using imagefield_crop module widget and it works in node/add form, but i cannot replicate it in my custom form api.


texts: How do I conditionally change the value of a field depending on the value chosen in another?

texts:
This was so easy in webform 4.x. However, I cannot seem to find it in webform 5.x.

I am creating a form using webform 5.1, and I need to set the value of the fees for a particular grade for an instrument, using conditional values (see attached screenshot for webform 4.x). So a person chooses the instrument, the grade in which he/she is to appear for examination, and then chooses whether it's a performance (practical) or grade (theory) exam. The fees value for the exam is programmatically chosen from a list of choices in the 'fees' field, using conditionals.

Now, for the life of me, I cannot figure out a way to do the same thing using the latest version of the module on drupal 8. Have the developers of webform changed things so that it is now impossible to do it in version 5 or is there a way that I am not aware of?

Any and all help is greatly appreciated...


texts: How to avoid showing duplicate content in Views?

texts:
I have a View block that displays all of the nodes written by an author on their profile. However, I'm having trouble with Views spitting out duplicate content.

For styling and functionality purposes, all of the fields are being outputted through an extra title field. I simply rewrote the output of the added title field, including tokens for all of my fields. I then set all of the fields (except for the rewritten title field) to "Display None", so that the fields were not duplicated.

Below is a screenshot of my current Views setup.

Here is a screenshot of the Views grid on the user profile. Ignore the missing images. I don't have all of the websites images synced to my local environment.

I tried using the "Distinct" option in the query settings, which eliminated most of the duplicates. However, Views continues to duplicate random content. Some content will have no duplicates, some content has multiple duplicates.

I've also tried using aggregation, but Views will not output anything when I turn aggregation on. I'd love for aggregation to be the solution, but I can't figure out how to get it to work.


texts: How to list subpages on separate menu per page

texts:
Say I have a structure like this:

Mammals
  Rodents
     Mice
     Gerbils
  Felines
     Ocelots
Birds
   Songbirds
   Raptors
       Eagles
Reptiles
    Lizards

Etc

I would like for the main menu to display: Mammals, Birds, Reptiles.

But when you are on, for instance, Mammals, or any of it's children. I wish for there to be an additional menu that shows all of the main parent and children (so in this case mammals, rodents, mice, gerbils, felines, ocelots).

Is there any way to set this up or a module that would help? I guess that the first step would be page groups, but I don't see reference to this hierarchy other than creating automatic menus.

(using drupal 7)


texts: How to select a particular user role which could be flagged

texts:
There are two Roles:

Authenticated
Artist

I have created a flag with flag type "USER".
The flag is used so that the Authenticated Users can follow the Artists.

As the flag is type of user, an authenticated user can even follow another authenticated user.

How do I restrict the flagging to be applied only to the Artist? i.e the authenticated user can only follow an Artist and no user of any other role.


texts: How to reverse order of pulldown Views Exposed Filter showing taxonomy terms reference field

texts:
In Views 3 D7, I have a view with an exposed filter pulldown that is based on a taxonomy vocabulary called Versions. The filter pulldown shows the versions in the order of the vocabulary (so 1.0, 2.0, 3.0) and I need it to show them in the reverse order (3.0, 2.0, 1.0).

I have tried using Better Exposed Filters to render the filter, but I haven't seen any option for sorting order. I also tried using the default Drupal filter and again no sorting order.

I tried using the Entity Reference solution in this SE post, but the problem is that I cannot then use autocomplete widget to create new Versions in the node/add form, so I'm locked (I think) into using term reference. Searched around SE and google for quite some time but no solution yet. Any help would be appreciated!


texts: How can I override certain breadcrumb segments?

texts: Drupal seems to be adding some default breadcrumbs that come from the URL.  How can I disable this feature? I don't see it in configuration but maybe I'm looking in the wrong place.


texts:
I am trying to use https for my website hosted using BOA 2.2.5, I am following this documentation:

http://community.aegirproject.org/content/content/administrator/post-install-configuration/using-ssl

The problem is after following the steps for Configure Your Aegir Server, I can't find the directory that it said would be created:

/var/aegir/config/ssl.d

/var/aegir/config/server_master/ssl.d


texts:
I would like to create a custom template for the user profile view. With the help of "Theme debug" I figured out that I need to create a template named html--user.html.twig, but even if I copy all content of page.html.twig to my new template, I do get a blank page for any user profile now. Can anyone tell me what I'm doing wrong? I cleared all caches though.

Which content do I have to copy to a custom template (suggested file name)?


texts: Is there any hook or way to modify the list of countries and states in the Location module?

texts:
I'm trying to change the Location module so instead of United Kingdom and its respectives counties, I could have England, North Ireland, Scotland and Wales, with their respectives counties. Do you know way to achieve this via any hook? Any ideas?.

So the idea is to be able to delete a country, and add some country with provinces/states, so they are available in forms and in exposed filters for views, for example.

Thanks in advanced.


texts: Is it possible to set a single member of a complex-variable inside the variable table

texts:
I want to use Drush vset to modify a subset of values stored in the 'variable' table's theme_themeName_settings record.

I've found references to vget and vset but all I've found so far is for the entire complex-variable.

Any help would be appreciated.