texts:
I am using the very helpful hybridAuth module to allow people to login with their social media accounts.

However, the login form shows up as shown below:

Looks a bit confusing, doesn't it?

I want to move the social media login button either to the top or bottom and create distinction with the actual login form

The form structure displayed at the top of the page is from hook_form_alter but I saw no obvious way to manipulate the form to achieve the desired effect.

I implemented the following code in an attempt to get my hook_form_alter to execute after hybridAuths' and perhaps find a way to reorder the form:

function mymodule_module_implements_alter(&$implementations, $hook){
    if($hook == 'form_alter '){
        dsm($hook, 'Hook');
        dsm($implementations, 'Implementations - form-alter');

        $group = $implementations['mymodule'];
        unset($implementations['mymodule']);
        $implementations['mymodule'] = $group;

        dsm($implementations, 'Implementations #2 - form-alter');
    }
}

However, my debug dsm code does not show up on my user/login page even though there is a form and hook_form_alter does respond to it on the same page.

Can anyone suggest something that might help, please?


texts:
I need to store a country and a region for geographical objects. Countries and regions are stored in a taxonomy vocabulary. Moreover, some countries have regions (as child terms) but someones don't have it.

I decided to create a complex field contains tid of a country and tid of a region. If an object doesn't have a set region, then a value of the region is 0 in this case.

I want to create a field widget for it. The widget should contain a combo box with a list of countries. Moreover, if the user is selected a country having regions, then a new combo box with its regions is appeared.

I have tried to do it with ajax like it is done in forms.

That is, I have written the following.
(Here I have removed some code from the source to shorten it)

  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
  {

// come code here ....

    // TODO: Implement formElement() method.
    $element['country_id'] = [
      '#type' => 'select',
      '#title' => t('Select a country'),
      '#options' => PalomGeo::getCountryList(),
      '#default_value' => $country_id,
      '#ajax' => [
        'callback' => '::changeCountry',
      ]
    ];

    $regions = PalomGeo::getRegionList($country_id);

    if ($regions!=[]){
      $element['region_id'] = [
        '#type' => 'select',
        '#title' => t('Select a region'),
        '#options' => $regions,
        '#default_value' => $region_id,
      ];
    }

    return $element;
  }

// Some code here

  public function changeCountry(array &$form, FormStateInterface $form_state){
    return $form['region_id'];
  }

But unfortunately, it doesn't work.

The error "The specified #ajax callback is empty or not callable" is appeared.

I want to clarify is it possible to use AJAX upon creating field widgets? If yes, does it differ from using AJAX in Drupal 8 Forms?


texts: Creating a "Related pages" view which also excludes the current node

texts:
I want to create a view-block of related articles. The base for distinction is a given vocabulary.

The node which serves as base to such related content list should be excluded from the list.

I couldn't find a way to achieve it with the basic type of view-arguments "Filter criteria". Maybe it is possible somehow with the seemingly more complex types of view-arguments "Contextual filters" ?


texts: How to fix Openlayers "Unable to load CTools exportable" errors

texts:
So, Openlayers 3.1 and 3.x Dev both have this issue. I've looked and this issue has been reported as fixed in the Drupal Openlayers issues list.

The issue is that everyone of my added layers, components, and sources each triggers these errors:

Unable to load CTools exportable Component (ol_users_geojson).
Unable to load CTools exportable Component (ol_geojson_chapter).
Unable to load CTools exportable Component (ol_geojson_reg_gr).
Unable to load CTools exportable Component (ol_geojson_alum).
Unable to load CTools exportable Component (google_base_layer).
Unable to load CTools exportable Component (users_popup).

Most of these components works in my map, except the popup, but that's a different issue. Part of the issue, is that this error is displayed prominently on my map page, even to regular users. What confuses me, is that for each of those components I'm following the OL examples, so I don't know why my custom implementations don't work. I speculate that this might have to do with the fact that the openlayers examples are all defined in code in the module, while my custom implementations are saved to the database and there might be an issue in how they are written there. There was an issue in the 2.x that some of the style component settings were getting mis-written to the db, but I haven't been able to find where in the db these are written to. From what I can tell, when I export my custom components they match those of the examples, so I'm not sure what's going on.

So, my question, which isn't obvious from the issue queue, is: is there anything I can do to fix this (patch, etc)?


texts: View of file entities, sorted by upload date, reorders when updating a file

texts: I have a view of file entities, sorted by upload date. When I edit one of the fields attached to one of my files the upload date of the file gets updated. The view now shows the last modified file first and no longer the last uploaded. Is this the normal behavior? Is there a way to actually sort my view by upload date?


texts: How might I make use of this Mobile Detect php class in a D7 site? Rather new to this so I'm really not sure where this can be implemented.


texts: Want to process node edit in two different ways

texts:
On every node page there is an edit and submit, you can set when the edit is available and such.

So, what I want to do is this.

When a regular user uses the edit button(which I want to be available for all site users), I want it to open the node and allow someone to directly edit it.  Just like when the owner edits it, it will open everything and allow the user to make changes.  But instead of actually saving the changes to that node, I want it to create a new node that copies the old one and saves this other user's changes.

When a moderator or the creator of the node edits, I want it to edit the node directly and saves the changes to that specific node.

I need to either create two buttons that show up differently on page for certain users, or use the same button but use some form validation technique to check the permissions of who is submitting the form and do the above accordingly.  Are there any ideas?  Any help is greatly appreciated!! Thanks


texts:
I've installed a fresh copy of Drupal 7.8 on an FTP server. For some reason, I am unable to run install.php, receiving the error:

  Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many
  redirects.

The files have not been altered in any way.

What could be the problem?


texts:
I need to get the setting on what length the teaser of a custom made content type is set.

I tried Google'ing for it, but so far I have ziltch results.
I also tried looking in the database, in the field_config_instance, field_config and the variable tables, but they couldn't give me a value either...

Now, I'm hoping you experts could help me to point me to the right direction?
Would be appreciated. :-)

Thanks in advance.


texts: Does the structure of the module's src folder matter?

texts:
I've read about the Basic Structure guide to building a Drupal 8 module. It's great that it outlines the basic files needed to get a module up and running.

Where it falls short is the contents of the src folder.

I've seen modules with the usual folders like src/Access, src/Plugins, src/Form. But I've also seen ones that appear to be arbitrarily named. Some files are referenced in annotations and yaml config, while some Drupal magically just knows about without some reference.

Does the folder structure matter? Does Drupal care if I put controllers in src/MaybeNotControllers? Are plugins like, formatters and widgets, still discoverable if not put in src/Plugins? Is there a definitive guide to what files go where and how Drupal finds out about them?


texts:
The titles of my nodes in Drupal 7 contain Urdu langugage (RTL) content. I have created a glossary view using Views module.

The alphabets of Urdu language are not in right order as they are in the original language.

For example,
(س (1) | ش (1) | ص (1) | ض (1) | ٹ (1) | پ (2) | چ (1) | ڈ (1

How do I fix sorting for View?


texts: Drupal Commerce custom pane as payment and shipping address

texts: Currently, Drupal Commerce does not have a solution for "shipping address is the same as payment address" checkbox, which is very unlucky. I was thinking of creating a custom pane with my custom addresses form, where I could easily create such a checkbox. However, I could not find anywhere how to trigger a payment (from commerce payment module) after the addresses form is successfully submitted. Could you help me? Thanks!


texts: Returning HTML through an ajax-call in Drupal 8

texts:
I am trying to grasp the MVC/Symphony integraton of Drupal and am making use of the controllers. My controller has a function named "returnHTML" which is called by a normal XMLHttpRequest. Problem is I do not know how to generate the HTML. I could use a theme, but implementing a theme feels a little bit too complicated for this simple task. I want a HTML-fragment, ergo what you see is what you get, not a complete webpage.

Is there a way to return HTML just specifying where a twig is and have this twig-file injected with data in the "returnHTML"-function immediately? Also is there a recommended class (like Symphonys JsonResponse) which will help with the headers?


texts: Implement an API to use HTTP extensions like CalDAV

texts:
I want to create a calDAV API endpoint. The client would contact my API using methods mentioned in the sabre DAV client documentation https://sabre.io/dav/building-a-caldav-client/ (sabre dav seems to be used by alot of projects so I am using it as a protocol documentation).
Now I am completely lost how to implement that in Drupal. There was a webDAV module but it's abandoned for 4 years and a calDAV module that's abandoned for 9 years...
Can I use REST API and hook it to respond to HTTP request methods like PROPFIND?


texts:
I have images of a certain image style that only show up after reloading the page. I can see the image created in the style directory after the first page request. Its like the browser is not waiting for the image to be created.

I wrote a curl script to request all the images of that style on the site, which works. But I'm worried that when new images are added they won't show on first request. Any idea what would cause that?

UPDATE:

I spent most of the day yesterday working on this. It happens when the derivative image is first created and served by Drupal. I found an extra new line character at the beginning of the image. If I save it to my desktop and remove the newline it works fine.

I read elsewhere that this can be caused by an extra space in a file like settings.php or template.php, usually before the <?php or after the ?> if it has one. I checked and rechecked those files and I've also been using find and grep to try and find the offending file but so far no luck.

I also tried adding header("Fake: fake"); to different files to see if I could generate a "headers already sent" error. But the output buffering Drupal uses seems to prevent that from working. Also I added $conf['image_allow_insecure_derivatives'] = TRUE;` to settings.php but that didn't fix it either.


texts: My question is similar to others, but not exactly the same. All the other answers have a specific discount (%) amount for Members, but my client needs to be able to set a totally different, specific price for each of their art classes for members, that is, there is no specific rule that applies to all classes equally. So, I created a Member Price field to hold each unique reduced price, but I'm not sure which action in the dropdown would switch out the base price for the price in that field.


texts:
During an update process of Open Atrium I ended up with the Organic Groups module (og) duplicated in sites/all/modules/og an profiles/openatrium/modules/contrib/og. I checked the 'system' table in the database and the one that's enabled is in sites/all/modules, however if I update the record in the 'system' table in order to use the module in profiles/openatrium/modules and afterwards I run the drush command

drush pmi og

and the output still reads:

Path: sites/all/modules/og

so where does drush get this value from?


texts: Printing a content pane with Printer, Email and PDF versions Module

texts: I'm trying to determine how to add a content pane with an argument to a custom tpl.php file that is adding some other things to the print version.  I've done this before with a block, adding in the region that I needed to print out with the block, but in this case I don't think I can just print out "content_bottom" etc.


texts:
I have a CT with a  Date (Unix timestamp) field implemented. It represents the start date of an event.

One simply question: Is there a way to compare somehow, this value with the current date() and when it matches (equal) the current date() to trigger an action? It must be equal, other way will trigger an action many times.

Up until now I've tried in hook_node_view to implement the whole logic, no luck.

This hook offers no accuracy on what someone wants to do.

Cron job's aren't suitable, cron isn't running every minute or second.

The other thing I've tried was Rules, but things become complicated, thought is the best way to follow!?
Any suggestions?


texts: Getting fields of a content type in template file - creating a slideshow

texts:
I need to add a slideshow (each slide containing headline, image & html text) in my frontpage. I've decided to create a custom content type named slideshow which should have above fields.

I've figured out the necessary .tpl.php file (page--front.tpl.php) in which I'll add codes to go for the slideshow.

What I've done already

Created a custom content type named slideshow with all the appropriate fields
Added all the necessary html for the slideshow in the .tpl.php template file - with necessary javascripts already included using the .info file of my theme.

Now the problem:

I think I'll fetch data from database & populate the variables needed in .tpl.php file in: preprocess function of template.php file of the theme. How do I retrieve the fields of slideshow content type from database?

Please help!


texts: Is it possible to give to a specific user role the permission to create content only in a language?

texts:
I've a Drupal 8 site using 8 languages. The site is not a multi-domain.

The Admin DE role should have only the permission to create nodes or translate nodes in German, but can view all node in all languages.

I don't find a module that can implement this functionality.
Do you have any ideas?


texts: Dynamic page title in views from a field of a node passed in url filter

texts:
I got a view of a content type 'A'.

I got relationships to another content type 'B'. Say 'B' has fields x, y, z

I have a contextual filter that gets a value from URL and filter such that B.x == value from url.

I could successfuly override the page title by the value of x by writing {{ arguments.x }}

Is it possible to overwrite the view page title to be B.y ??

Another question is about the breadcrumb, it is not affected by the override and always show the static page title. Is there a way to fix that?

I am currently using 8.3 alpha1 although I've been trying this on 8.2.5 as well.


texts: how to optimize inline images in ck-editor

texts:
Is it possible to optimize inline images uploaded via ck-editor.

There is an image with size 11 MB and in default behavior its rendered original without any optimization applied to it.


texts: Field API - defining a field, attaching it to privatemsg, and populating it "behind the scenes"

texts:
This is actually related to a previous question ( Appending markup to privatemsg message body ) but as it's a slightly different issue I figured I'd start a new question.

In my original question, tenken's suggestion is to create a new module implementing hook_field_info(), then use field_create_field() and field_create_instance() on hook_enable() to attach the custom field to the privatemsg bundle.

I have sort of figured out the gist of defining a custom field and attaching it to a bundle, but I'm stuck with a few things despite extensive googling, searching drupal.org and documentation as well as searching for video tutorials on YouTube. Specifically:

when populating arrays to use with field_create_field() and field_create_instance(), I'm not sure what I should specify for the entity_type value. I know typical examples for these functions usually refer to 'user' and 'node', but what should it be for privatemsg?
I don't want the field to be visible on any forms as it's only intended to be populated "behind the scenes". I understand that I need to define a custom field formatter for that. How do I do that?

I think those are my only obstacles at the moment. Sorry if I appear lazy at all, but I only have very limited experience with Drupal module development, much less the field API, and this is my first D7 module. Needless to say I have searched for specific answers to the above but they continue to elude me!

Thanks


texts: Do views filter plugins not apply to base field definitions?

texts:
I created a custom entity type that has a base field definition like this:

$fields['start_date'] = BaseFieldDefinition::create('datetime')
  ->setLabel(t('Start Date'))
  ->setDescription(t('The date and time to start.'))
  ->setDisplayOptions('view', array(
    'type' => 'datetime_default',
    'weight' => 3,
  ))
  ->setDisplayOptions('form', [
    'type' => 'datetime_default',
    'weight' => 3,
  ])
  ->setRequired(TRUE);

When I create a view that displays entities of this type, and try to create a filter on this base field, I get the generic filter provided by views, instead of the one defined in Drupal\datetime\Plugin\views\filter\Date.

Why is that?


texts: Fetch multiple latitudes and longitudes using geo location

texts:
I want to fetch multiple latitudes and longitudes using Google Geo API. I am using the GMap module to render a map in which I fetch business listing address from the database and I want to display Google listing also.
For example, http://maps.google.com/maps/geo?q=bars;near=chicago&radius=500&output=csv' returns a single latitude and longitude, but I want all the latitudes and longitudes of bars type near Chicago.


texts:
I have built a search page using Search API, specifically the database version. This search page is a simple view and works exactly how I'd expect it to.

However, now I need to update the index so that it will search taxonomy terms associated with each piece of content. For reference, the field in question is field_author as a piece of content can be associated with several different authors.

From reading online, it seems like I should be able to edit the search index, scroll down to Add Related Fields, add Author, and that makes additional fields show up in the selectable fields to index section.

From there, I check the box beside Author >> Name (field_author:name), click Save Changes, and reindex my field.

However, a search for an author name does not produce any search results and I'm not sure why.


texts: Problem when downloading large files using Storage module

texts:
I'm using the Storage module to managed uploads on my website. I'm hosted on EC2, some content is sent to S3, and some stays on EC2.

Logged in users are able to transfer files to each other. One user uploads the file, and the other goes to download it.

The files that are causing problems are stocked on EC2.

A user is able to upload a large file (4 gb for example), to the server, but when someone tries to download the file, they get a file of 0b.

I checked via FTP and the file is there and complete (i downloaded it and opened it).

When moving the file to another directory (/default/files/file.zip), it works. If it is in the "/system/storage/serve/359/file.zip" it doesn't work.

--- EDIT ---

Forgot to mention that it DOES NOT happen with small files.

--- EDIT ---

Does anyone has any suggestion?

Thanks !


texts: User resetting password, week later needing to reset it again

texts:
I have a develop and a production version of a site running behind a firewall. In production the users passwords are somehow being reverted and once the user resets it, they get a random amount of time and are required to reset it again. I cannot track this down. Looking for any suggestions on what is going on. I have looked in the logs, but don't see any flags.

Setup consists of 3 servers. One for Drupal App, One for MySql DB, One for Solr.


texts: Textfield default value to user email NOT WEBFORM

texts:
I am using the Drupal 6 Form API to build a custom form. I am not using the Webform module or CCK. How do I assign the user's email as a default value for a form element?

I know about #default_value => but I do not know what to assign to this.


texts:
Posted by pennyc on December 14, 2014 at 3:21pm

I've created a View over a summary of my tags using
Relationships
Content: Taxonomy terms on node

Contextual filters
(term) Taxonomy term: Name

and it works well only that I get as first post a category named "Uncategorized" which don't exsist. How did this happend?

I'm also doing a summary over some Content Types using
Contextual filters
Field: Name

Relationships
Entity Reference: Name

but this time all I get is the ID and number of posts and not the title of the content type. What have I done wrong here?


texts:
i have a variable_set  defined in d6 as follows :

variable_set('cleanupeditform_formkeys', array(
 'menu' => t('Menu settings'),
 'revision_information' => t('Revision information'),
 'attachments' => t('File attachments'),
 'comment_settings' => t('Comment settings'),
 'author' => t('Authoring information'),
 'options' => t('Publishing options'),
 ));

How i can convert to drupal 8 form ? I know for a single case it would be like

\Drupal::state()->set('cleanupeditform_formkeys','my_value');

Thanks .


texts: I have about 30,000 nodes I need to load and resave so things like autotags and url aliases get generated.  Is there a quick script I can write to do this?


texts: Determining content access by role for viewing content?

texts:
Here is the scenario:

I have 10 roles (plus the 3 core roles, anon, auth, administrator).
I have 7 roles imported from an outside system.
Users can belong to multiple roles.
Editors need to be able to check off in a list of these roles when editing content, as to whom can view the content.
If none are selected, anyone can view.
A user only needs to possess one of the roles checked off in order to have access.

There does not seem to be a solid solution for Drupal 8 out there. Content Access is unfinished, Permissions by Term is too restrictive, and Access by Entity currently does not work.

What is the path of least resistance to enabling view based access if the options are enabled? Where can I start?


texts: Bootstrap framework - Sub-theme template.php not having any effect

texts:
I installed bootstrap framework for drupal and copied the sub-theme into my themes directory, renamed all the files accordingly and everything works fine, however any php code that i put in my sub-theme template.php file is not having any effect.

I tried adding google fonts, css files and some other functions to template.php but nothing works, even tho the code is valid.

I wonder what am i doing wrong? Should i be editing base theme template.php file, even tho it will get updated and deleted? Or is there some other reason why my sub-themes template.php has no effect?


texts: Multiple filenames in Entity form notification mail

texts:
I have an Entity form with a file upload and need to include multiple filenames in the mail that is sent to the site admin upon form submission.

If I only allow one file to be uploaded through the form the replacement pattern [entity:field-uploadfield:file] works fine to make rules display the filename in the notification mail. But if I enable the users to upload multiple files the replacement pattern does not work anymore – how can I solve this?

Edit:
[entity:field-uppladdarfaltet:0:file] works, but then I'd have to cap the number of files at like 10 and also this doesn't really seem like a "clean" solution. Can I use the :0 :1 :2... format to support an unlimited amount of files?


texts: Show the ID of referenced entities using tokens, instead of the label with link

texts:
I have a content type, Company, which is referenced to a User with an entity reference. The token for that entity reference for the current user is     [current-user:field_user_company].

No matter how I configure the field I'm using the token in, when using this token, it always translates in a the label with a link TEST COMPANY.

Is there any way I could make this token translate into just the Node ID (17 in this case)?  I would need just the ID to pass the reference on to other entities in a workflow (using Rules or Business Rules).


texts: Using a different local non-Drupal database to store entities?

texts: So we have a simple mysql database that stores information about people, which is used by multiple sites on our environment. I'd like to use entities to interact with this database, but I can't figure out an easy way to tell the Entity API to use this database for the entity without overriding a bunch of stuff in Entity API with db_set_active('test'); and then  db_set_active();, which seems really clunky and like it will cause someone to seriously resent me (possibly future-me) when they work on this down the road. Is there a more elegant solution to this?


texts: In Drupal 8 how do I programmatically get a list of bundles for an entity type, for example the list of content types. Specifically, I'm looking for the machine names.


texts: Trying to create a table with an uid field that auto-increments and is the primary key, but keep getting an error

texts:
I'm working on an .install file for my module in Drupal 7.  I want to create two tables, one called tls_connect_floormap_images and one called tls_connect_floormap_coords.  I'm not having any trouble with the _images table.  But when I try to make the uid field of the _coords table a unique key that auto-increments, I get an error that says:

  Fatal error: Unsupported operand types in C:\Program Files
  (x86)\Zend\Apache2\htdocs\TLSConnect3App\includes\database\mysql\schema.inc
  on line 85

I get this error on install, When I Save Configuration I get the WSOD with the error message.  When I put in the url for /admin/modules there is an error that says Notice: Undefined variable: schema in floormap_install() (line 37 of C:\Program Files (x86)\Zend\Apache2\htdocs\TLSConnect3App\sites\all\modules\custom\TLSConnectPackage\floormap\floormap.install).  I see that the module is installed though, and when I check for my tables in phpMyAdmin they are there, uid auto_increments but is not a unique or primary key.

Here is my code:

function floormap_schema(){
    $schema['floormap_images'] = array (
            'description'   => 'Floor map images.',
            'fields'        => array (
                'image'     => array('type'     => 'blob',      'not null'  => TRUE,),
                'name'      => array( 'type'        => 'varchar',       'length'        => 30,      'not null'  => TRUE,),
                'active'    => array('type'     => 'int',           'unsigned'  => TRUE,    'not null'  => TRUE,),
            ),
            'unique keys'   => array('name' => array('name'),
            ),
        );
    $schema['floormap_coords'] = array (
        'description'   => 'Floor map images.',
        'fields'        => array (
            'uid'       => array( 'type'    => 'serial',    'unsigned'  => TRUE,    'not null'  => TRUE,),
            'floormap'  => array( 'type'    => 'text',  'not null'  => TRUE,),
            'item_type' => array( 'type'    => 'text',  'not null'  => TRUE,),
            'pos_a_x'   => array( 'type'    => 'int',       'unsigned'  => TRUE,    'not null'  => TRUE,),
            'pos_a_y'   => array( 'type'    => 'int',       'unsiged'   => TRUE,    'not null'  => TRUE,),
            'pos_b_x'   => array( 'type'    => 'int',       'unsigned'  => TRUE,    'not null'  => TRUE,),
            'pos_b_y'   => array( 'type'    => 'int',       'unsiged'   => TRUE,    'not null'  => TRUE,),
            'pos_c_x'   => array( 'type'    => 'int',       'unsigned'  => TRUE,    'not null'  => TRUE,),
            'pos_c_y'   => array( 'type'    => 'int',       'unsiged'   => TRUE,'   not null'   => TRUE,),
            'pos_d_x'   => array('type' => 'int',       'unsigned'  => TRUE,    'not null'  => TRUE,),
            'pos_d_y'   => array('type' => 'int',       'unsiged'   => TRUE,    'not null'  => TRUE,),
        ),
        'unique keys'   => array('uid' => array('uid'),),
    );
    return $schema;
}
function floormap_install() {

    //Create table to store floor map images if it doesn't already exist
    if(!db_table_exists('tls_connect_floormap_images')){
        db_create_table('tls_connect_floormap_images',$schema['floormap_images']);
    }
    //Create table to store floor map coordinates if it doesn't already exist
    if(!db_table_exists('tls_connect_floormap_coords')){
        db_create_table('tls_connect_floormap_coords',$schema['floormap_coords']);
    }
}

I only get the error when I have

'unique keys' => array('uid' => array('uid'),),

in the $schema['floormap_coords'] array.  It works in the ['floormap_images'] array though, not sure why its not working for coords.  The only difference is that the 'uid' field is serial datatype and name is varchar.


texts: Drupal.attachBehaviours() on Block that got rendered via ajax call

texts:
i'm rendering a form and using an alter hook for changing the form to submit via ajax. This works like a charm. ( Drupal 8 webform with webform_ajax )

Now i want to render the form via ajax into the content. This also works.

Because the content is not there on page load i have to re-apply the drupal behaviours.

This is the thing i can't get to work.

Here's the code i use:
Form.js

(function ($, Drupal) {

  'use strict';

  var $modal = $('#modal');
  var url = $('.block-system-main-block > article.node').attr('about');

  Drupal.behaviors.formInModal = {
    attach: function (context, settings) {
      $(context).find('.js-engagement-link').once('js-engagement-link').each(function () {
        var targetForm = $(this).data('target');

        $(this).click(function(){
          $.ajax({
            url: '/contact_bridge/webform/' + targetForm
          }).done(function(response) {
            $modal.find('.modal-content').first().html(response);
            $modal.foundation('open');
            Drupal.attachBehaviors($('#modal')[0], settings);
          });
        });
      });
    }
  };
})(jQuery, Drupal);

Form alter:

public function formAlter(array &$form, FormStateInterface $formState, $formId) {
  $webformSubmission = $formState->getFormObject()->getEntity();
  if ($this->isAvailable($webformSubmission->getWebform())) {
    $ajax = $this->getAjaxProperties($formId);
    $form['#prefix'] = '
';
    $form['#suffix'] = '
';
    $form['actions']['submit']['#ajax'] = [
      'callback' => '\Drupal\webform_ajax\Controller\WebformAjaxController::ajaxSubmission',
      'wrapper' => $formId . '_wrapper',
    ]
  }
}

I tried many different calls to attachBehaviours, nothing seems to work. The alter hook is applied to the form and the ajax wrapper is there.

-- edit1 --

Here the code on the backend side for rendering the block:

<?php

namespace Drupal\contact_bridge\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Render\HtmlResponse;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Drupal\webform\Entity\Webform;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 *
 */
class ContactBridgeController extends ControllerBase {

  /**
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManger;

  /**
   * @var \Drupal\Core\Render\RendererInterface
   */
  protected $renderer;

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager'),
      $container->get('renderer'),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function __construct(
    EntityTypeManagerInterface $entityTypeManager,
    RendererInterface $renderer
  ) {
    $this->entityTypeManger = $entityTypeManager;
    $this->renderer = $renderer;
  }

  /**
   * @param string $webformid
   * @return \Drupal\Core\Render\HtmlResponse
   */
  public function getWebformBlockHtml($webformid) {
    $webform = Webform::load($webformid);
    $renderArray = $this->entityTypeManager()->getViewBuilder('webform')->view($webform);

    $html = $this->renderer->renderPlain($renderArray);
    return HtmlResponse::create($html);
  }

}

And the routing:

contact_bridge.webform:
  path: 'contact_bridge/webform/{webformid}'
  defaults:
    _controller: '\Drupal\contact_bridge\Controller\ContactBridgeController::getWebformBlockHtml'
  requirements:
    _permission: 'access content'
    webformid: ^[a-zA-Z0-9_]+

Can somebody tell me what i'm doing wrong?

Thanks in advance.


texts:
How do I add client-side form validation to a Drupal form?  For example, in the comment module.  If the vistor don't enter the email address, I want to popup a window that says: "please enter the email address".

I hope someone can give me an example of how I do this.


texts:
I'm writing a contrib module but I can't find the documentation to run the tests - unit and functional. I know that I'm supposed to use PhpUnit, but I can't find examples of PhpUnit configuration files and more importantly, there is no resource on how to execute functional tests - i.e. having the module tested against a running Drupal instance.

I've been looking at some famous contrib modules like Paragraphs and there is nothing about running tests in their documentation - and no phpunit dependency at all. Which doesn't make sense to me since there are some functional tests implemented.

How are we supposed to provide tests for contrib modules?


texts: Does hook_install() get called before or after configuration yml files are loaded?

texts:
In Drupal 8, during module install, is hook_install() called before or after loading the .yml files in config/install?

I've across a module that's using both (which seems like a bad idea on its own) and I'm trying to run down the cause of an inconsistency in the configuration right after the module is installed.


texts:
Drupal 6

How can i allow drupal to accept #idname as link? When I put # I cannot submit the form. Is there a way to do this?


texts: Slashes in single route parameter or other ways to handle a menu tail with dynamic number of params

texts:
According to the Symfony documentation, a route defined as below should trigger the specified controller for both /hello/bob and /hello/bob/bobby:

_hello:
  path:     /hello/{names}
  defaults: { _controller: \Drupal\mymodule\Controller\Main::Controller }
  requirements:
    _access: 'TRUE'
    names: .+

In the case of a request to /hello/bob/bobby the {names} param would be "bob/bobby" (slash intact) and it would be up to the controller to break that down into multiple variables or to leave it as a single string. The trick to that is the altered regex (".+") used to filter that {names} param.

This stackoverflow post also implies that custom regex can be used to allow slashes in a route param (at least in Symfony 2).

If I try this against Drupal 8.0.0-beta15 it does not work and the specified controller is only triggered for a request to /hello/bob. However, I can confirm that this used to work in previous betas (I think up until ~beta13).

Has something changed in the way Drupal integrates with the Symfony routing component that would explain this? Perhaps there is an alternate way to accomplish the passing of slashes in routing params? I know there is a movement toward Symfony 3.0 in core, but I'm not sure if that could explain things.

I also know that route subscribers are available to manage dynamic route structures. However the case I am working on requires an almost infinite combination/number of dynamic parameters at the end of a base path (but which are trivial to parse in my controller). I'm also trying to avoid query strings (e.g. /hello?names[]=bob&names[]=bobby) for this case.

Mainly I'm just confused as to the disconnect with the Symfony documentation, which seems to state that this should be possible.

Additional Notes

After posting this question I discovered this discussion in the D8 core queues: [Discussion] Drop automated passing of extra argument: Y/N. It seems to conclude that "menu tail" support (which is essentially what I am after) will officially be dropped in D8. That discussion ended 3 years ago and so I can only guess that some of the more generalized implementation specifics were not fully realized until recently (~beta13). This may explain why I've only now noticed this change.

I'm guessing that Drupal (not Symfony) is now generating a 404 response based on the raw slash-delimited request before any of the Symfony-specific routing logic further dissects the route (and it's param-specific regex, etc.). If this is the case it could explain why technique above stopped working. I am still wondering however if there are alternative ways to deal with this need that avoid using query params and custom route subscribers.


texts: Take 2 fields in a content type with php

texts:
I have a content type with the following fields:
Name, Language, Date, Photo, Text
associated with the following names for internal use:
title, language, field_date, field_photo, body

I created instances. One of these is called "Mondovi." I would like to see only the fields field_data and body of this instance. I want to use php to put them within the content or within a block. What to do?


texts: Can a view and a content type share the same alias pattern?

texts:
I'd like to have this URL structure on a Drupal 8 site:

/schools/usa -> handled by custom view
/schools/europe -> handled by custom view
/schools/school-name -> handled as a normal node

So basically when the users makes a request for a URL like /schools/%, Drupal first checks if it finds a node with that alias and, if it doesn't exist, passes on to the view (or vice-versa, view first and then node if the view argument doesn't validate).

Is this achievable?

If I try, the view gets the precedence and throws a 404 on /schools/school-name as "school-name" fails to validate as a taxonomy term (it's a node title after all...)


texts: View/query to show latest node related to each term in a taxonomy vocabulary

texts:
I have a node type (stories) which is related to a taxonomy vocabulary (countries).

Each story is related to one country only.

I want to create a view of the latest story from each country, ordered by published date.  I only want 1 story from each country (if there is one).

I looked into doing this with views and couldn't see a way to limit the results to only 1 result per country.

Does anyone have any suggestion how I can do this without writing a custom query?

Thanks,


texts: How to programmatically determine if the cron is running

texts: Is there any way programatically to determine when the cron is running (and if possible, what tasks are being run)? I've explored some options online that are bound to drupal_cron_run(), but no examples on how to listen for this method being used, as it is intended to start the cron.


texts: How does Strongarm decide which variables need to be included in a feature

texts:
When you enable Strongarm on a site that is already using Features, do these two modules work together to determine which Strongarm variables need to be included in a Feature, or is there additional work that needs to be done to ensure that the correct Strongarm variables are included?

If more work is needed, what needs to be done?


texts: View with referenced nodes from field in the same paragraph possible?

texts:
I can not seem to figure out how to set up the correct contextual and relationship settings to accomplish the following:
I have a node with a paragraph named slides. In the paragraph slides there is an entity reference field named field_selected_content that references various other nodes on the site.
I have a view called Slider, which is then printed in the Slides paragraph template.
The problem is that the view collects all references from all over the site from the field in the paragraph – I only want the once referenced by that specific paragraph (or if that is not realistically possible, at least from the same parent node ID).
I've experimented both with a regular block view as well as a "paragraph view". But as soon as I try to apply a contextual filter with ID provided by url no results are shown. That said, I don't fully understand the whole relationship/contextual concept as it seems quite intricate so I might have overlooked something really obvious perhaps?


texts:
I want to have the views header elements after exposed filters, so i try to get the filters in the header. For that, i expose them in a block, and try to add that block to headers, but no success. I also tried to show the filters-block on the view's page (an admin path) via the block settings (show in content area, only on pages admin/content/myview), also no success.

To add a generic block to a views header via UI, there's the module
https://www.drupal.org/project/views_block_area

On the module page it says

  Blocks that are generated by views, can't be selected. These blocks can be inserted by views areas.

But i can't see how to do that. When i add a view area to my view's header, i have the view which generates the exposed-filters block, but the block is not listed, only the default and an attachment i have in that view.


texts: Get form values into hook_node_insert / hook_node_update

texts:
I need to get in hook_node_insert and hook_node_update the value of a field I manually added to a form.

function hook_form_FORMID_alter(&$form, FormStateInterface $formState, $form_id) {

  $form['newfield'] = [
    '#title' => 'New field',
    '#type' => 'checkbox',
  ];
}

In Drupal 7 every form field is copied to the entity and it's easy to access it as explained here Get data form into hook_node_insert / hook_node_update

Is there a way in Drupal 8 too?


texts: How to add markup inside a form radio button div

texts:
Currently I have a form displaying radio buttons and I added some markup to it by attaching #suffix to the form element. However, I found that this didn't do exactly what I needed. This created the following code structure:

     ...

            <input type='radio'></input>

            <input type='radio'></input>

Markup goes here

I'm trying to figure out how to add markup inside the 'radio-button' div, right after the label tag. How can I do this? If there is no Drupal way of doing it, I can add it with javascript, but that's not ideal.

EDIT:
I have chosen to try using a custom template for this form element, but its not working. Here is my code:

'my_module_is_member_radios' => array(
  'variables' => array(
    'description' => array(),
  ),
   'template' => 'templates/my_module_is_member_radios',
),


texts:
Here is what I am trying to do.

If there is an empty image field on a node I want it replaced based on what taxonomy terms are on the page, but the key is I want to apply it site wide so it will affect not only the tpl files but Views as well. I'm guessing this needs to be done via mytheme_preprocess_field in template.php but I'm not quite sure how to do it.

I can easily do this in node.tpl.php but I need it done site wide, not just in the node-type template.

VID 1

TID 1
TID 2
TID 3
TID 4

VID 2

TID 5
TID 6
TID 7

VID 3

TID 8
TID 9
TID 10

Here is what I am trying to do.

// Set Variables
$term1 = $content['field_term1'][0]['#markup'];
// Must use if statement or else there will be an error
if ( isset( $content['field_term2'][0]['#markup'] ) ) {
  $term2 = $content['field_term2'][0]['#markup'];
}
// Must use if statement or else there will be an error
if ( isset( $content['field_term3'][0]['#markup'] ) ) {
  $travel_type = $content['field_term3'][0]['#markup'];
}
if (isset($content['field_node_image'][0]['#item']['uri'])) {
  $image_path = file_create_url($content['field_node_image'][0]['#item']['uri']);
} else {
  switch ($term1) {
    case 'TID 1':
      switch ($term2) {
        case 'TID 5':
          $term_type = '5';
          break;
        case 'TID 6':
          $term_type = '6';
          break;
        case 'TID 7':
          $term_type = '7';
          break;
      }
      break;
    case 'TID 2':
      $term_type = '2';
      break;
    case 'TID 3':
      switch ($term3) {
        case 'TID 8':
          $term_type = '8';
          break;
        case 'TID 9':
          $term_type = '9';
          break;
        case 'TID 10':
          $term_type = '10';
          break;
      }
      break;
    case 'TID 4':
      $term_type = '4';
      break;
  }
  $image_path = '/sites/all/themes/themename/term-images/' . $term_type . '.jpg';
}


texts: Add an item to a checkbox in a content type

texts:
I started working with drupal recently and I have been assigned many small tasks. I would like to know how I can add an item to the following checkbox, I can't understand how:

Thanks in advance!


texts:
currently I'm using two hooks in my hook.module. hook_form_alter() and hook_mail_alter().

In hook_form_alter() I use drupal_get_messages() to retrieve the status message.

And I want to use hook_mail_alter() to add this message to the email. But I can't pass the message content from one hook to the other.

A global variable is not working. Is there a better way? Another hook I'm not aware of?


texts: How to change the user-facing label for a Commerce payment option?

texts:
I'm using Commerce Braintree as a payment method, which accepts both credit cards and PayPal. Currently it looks like this, which some users are getting confused by since it's not clear that the PayPal button is an alternative to the credit card info options:

I'm getting worrying confused customer comments like "But I don't have a PayPal credit card number", so I'd like to edit this label so that it informs the users that they are being presented with two options (PayPal or credit card), but I can't find any way to:

There's nothing in the UI
The feature request to enable it was rejected, a follow up request is incomplete
A suggestion to use hook_form_alter doesn't work with all payment methods
I don't want to use string overrides because it's too blunt a tool, replacing "Credit card" everywhere would have unfortunate consequences elsewhere

How do I this be done?


texts:
Any potential issues with enabling keep alive in the .htaccess file for my Drupal 7 websites?
 Header set Connection keep-alive


texts: how to create a custom form and embed it on a node

texts:
Right now, I want to create a form which only have an email textfield and a submit button.

This is what I did in my "custom_request_price.module":

function custom_request_price_form(&$form, $form_state) {

  $form['email'] = array(
    '#type' => 'textfield',
    '#size' => '20',
    '#maxlength' => '255',
    '#required' => TRUE,
  );
  $form['email']['#attributes']['placeholder'] = 'Email Address';

  $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Send');
  );
}

However, I don't know how to embed it to my article. I don't want to add this into a menu or make this as a new page. What I want to do is: when I open my article page, it directly showed up and visitors can enter their email address and simply to click "send" button.

My search:
For doing this, I thought I need to add "drupal_get_form()" in my node-article.tpl.php to show this form on my article page. I am totally new for doing this. I don't know how to add form-ID in my custom module. Also, I don't know whether this is the correct way to embed my form.


texts: Avoid caching a JavaScript file when the page cache is on

texts:
So I have a custom block that shows a div and a JavaScript (tried inline and file), while page cache is on.
JavaScript loads a uncacheable token got generated through a php function called within block view.
I tried using drupal_add_js to pass parameter to setting and on second drupal_add_js to load file and set cache to false. But setting get cached and provide cached parameter to JavaScript which i dont want.

drupal_add_js('var videoPlayer = Player.create("' . $container_id . '",' . '"' . $embed_code . '", ' . $params . ');',
        array(
          'type' => 'inline',
          'async' => TRUE,
          'scope' => 'footer',
          'cache' => FALSE
        )
      );


texts: How to show an Inline Entity Form on a PM page or panel?

texts:
I'm trying to include an Inline Entity Form on a panels display (via ctools Page Manager).

The Inline Entity Form field is attached to users, and the page in question has the user's context.

The Inline Entity Form field does appear in the panels interface, in two different ways, but neither work:

As a "User" field content type

It simply displays the text 1

As a "User (tokens)" content type

It simply displays the text 1

As a "Form" content type

It simply display the text Entity info


texts: Only show menu level 2 from active trail (with option Show as expanded)

texts:
I'm trying to do something pretty basic in my perspective, but I keep failing at this simple task.

My website has a main menu that is displayed on top of the page that is 2 levels deep (hence the Show as expanded). On the left toolbar it has another display of main menu, starting from level 2.

I have a main menu that looks like the following:

-link 1 (has option show as expanded)
--link 1.1
--link 1.2
-link 2 (has option show as expanded)
--link 2.1
--link 2.2

Problem now is that in the left toolbar all my level 2 links are always displayed, probably because I expand them. But I only want to view the children from my active trail.

Is this possible at all with the current setup? When I deselect Show as expanded, my top menu doesn't show the second level (except when I click the first level first = active trail).

Another problem with this new (menu) block system is that I use a template to render my main menu: menu--main.html.twig but both my top and left menu use this template. Is there any best practice to separate the templates?


texts: How to show the parent and child taxonomy term?

texts:
I have a vocabulary like this:

Parent 1

Child 1
Child 2
Child 3

Parent 2

Child 1
Child 2

Now I would like to use a view to create a list of a Parent term with its Child terms. I try to do this with Views UI, but only show the term parent... No the child term's. It is very confusing for me.

Can anyone help with this case? Thanks :D


texts: How to override file_public_path in install profile?

texts:
I want to create an install profile that creates the files folder in the document root, www.example.com/files, and not the sites/default folder.

I have tried two methods of doing this and both partially works, they create the folder in the correct place, but when the site is finished installing the admin/config/media/file-system is showing "sites/default/files".

Method 1 used:

Added "$conf['file_public_path'] = "files";" to settings.php

Note: This line was actually removed from settings.php after installation finished

Method 2:

added the below code to [myprofile].profile:

function sitebase_install_tasks_alter(&$tasks, &$install_state) {
  $GLOBALS['conf']['file_public_path'] = 'files';
}

In both cases the Verify requirements step was testing for "files".

How come Drupal all of a sudden seems to lose this setting and instead inserting the wrong value in the db? Do I need to also manually insert this in the db in [myprofile].install?


texts:
Is there a way i can make file_managed URI changes in the database?

I the database i have a list of files and there is append a _1 or _2 to the URI file name.i wanted to clean these up and remove the _number so there will be only one file but when i change it i get an error unable to write row duplicate entry for uri key.


texts: How do I add the "error" class when a form validation fails?

texts:
I'm working with Drupal 7.56 and I am using the Webform module to create a custom form.

I used hook_form_alter() in a custom module to add a validation test.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id=='webform_client_form_1') {
    $form['#validate'][]='mymodule_form_validate';
    return $form;
  }
}

function mymodule_form_validate($form, &$form_state) {
  $aux = $form_state['values']['submitted']['aux'];
  if ($aux != '') {
    if( /* my test */ ) {
      $text = t('Please check your input');
      form_set_error('aux', $text);
    }
  }
}

How can I add the error class when my test fails?


texts: How do I grant edit access on workbench to specific users?

texts:
All the users have a field, field_country.
All the content types have also a field, field_country.
I want the logged in user to be able to edit in workbench, his own content and the content added by other users of the same country.
I managed the first.
How can the second requirement be implemented?
Which hook should I use? Is there any example?


texts:
I'm having a little bit of trouble with joining 2 different content types in a view.  I'm am using Entities and View modules.

What I have is about 50 satellite offices and each office has a varying number of employees.  I have created a content type of "Office" and created a separate content type of "Employee".  Using the Entities module, I enter a new employee into the system and assign them to a particular office.

Now, what I want to do is basically build a view where I can look at an office, see it's information (address, etc) and also see a list of employees associated with that office.

I've got the relationships and everything set up so the data pulls over, however, the issue I'm running into is duplication of some fields that I don't want to show twice.

Here's what happens:  If Office 1 has two employees, the data returned shows Office 1 twice, each with a different employee.  What I want is for Office 1 to show ONCE, with a list of all employees at that office.

I've tried grouping options, but that doesn't work right either.

Any ideas on how to get this formatted the way I need?


texts: FAPI 'radios' don't respect '#default_value'?

texts:
I noticed that the 'comment settings' radio buttons ('#type' => 'radios') were not respecting their default value settings in my content types.

I have several module created custom content types, as well as the normal 'Page' and 'Book' content types in this D6 installation, and all of my custom content type's node forms are appearing with apparently random values for their default values.

Repeated loads of the same node form shows different default values for 'comment settings' every time. Looking at the $form arrays for my content types and comparing them against the $form array for a Page content type I only saw one difference: the use of the '#parent' element; I added to my logic (as shown below) but it makes no difference.

I noticed this while trying to create a 'radios' form element for a non-node creation form. Here's some logic I'm using that should give me a consistent default value, but does not:

$form['radios-test'] =
    array( '#type'          => 'radios',
           '#parents'       => array('radios-test'),
           '#title'         => '',
           '#default_value' => 0,
           '#options'       => array(t('first'), t('second'), t('third')),
           '#description'   => 'explainer text goes here',
         );

What am I missing here?


texts: Lightest way to control a field's markup

texts: So far I have used Display Suite to control the output of entities. This especially applied to node's fields which by default receive multiple wrappers (like field-items, field-item, zebras and such) which I don't need. Correct me if I'm wrong, but I would say that installing Display Suite only for that purpose is a big overhead. If you agree on that, what would then be the lightest way to get exactly the markup I want?


texts: Huge amounts of locale queries clogging up drupal to 40 MB per request

texts:
I got an email today from my hosting company stating that they had to kill some processes of my site because it was using too much memory. Looking at the process table they provided, there were 10 processes of 40 MB, while my limit is 256 MB.

This poses me with two problems to solve.

1: Each page request drupal creates a process which uses 40MB of memory (which is of course killed again after the page is loaded). I've installed Devel and saw that each page makes around 900!! queries to the DB, most of which are from locale. All of them like this one:

   0.28270 locale P A E

   SELECT s.lid, t.translation, s.version
       FROM locales_source s
       LEFT JOIN locales_target t ON s.lid = t.lid AND t.language = :language
       WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'
   default

How can I reduce this?

2: Apparently some1 put in 10 page requests at the exact same time (elapsed time of each process was equal). Is there something I can do about this?

If you need any more information please ask. Thanks in advance.


texts:
Possible Duplicate:
  How to simply make the whole site https

I have my drupal 6 website running on apache. I want this site to run only on HTTPS. What should be done for this. There are lot many solutions, which are getting me confused. Please help me on this.


texts: Add callback to existing migrate field mapping

texts:
I have a use case where I want to use the callbacks functionality for the body field in a D6->D7 migration using migrate and migrate_d2d modules. However, according to the above-referenced docs page, this is done when you are adding a new field mapping:

$this->addFieldMapping('destination_field', 'source_field')->callbacks('my_callback');

not adding to an existing mapping. How can I add a callback to an existing mapping? Do I have to remove and then re-add the mapping, or is there another way?


texts: Views: relationship between tables in two different databases

texts:
I've a View that shows data from an external database
I want to show also data of another table (from the default drupal db) that has a logical relation (like  a foreign key).
The databases are on the same MySQL server.

It's possible?


texts: How do I deploy a Page Manager page using code?

texts:
I've created a Page Manager page using a Panels layout and a single Variant to act as the desired page. I'd like to store the settings in code for deployment to a different server.

Using Features to export the Page Manager (page_manager_pages) component appears to have done this, however the newly deployed page variant's content tab is empty. The page settings have come through, but the page contents don't show up, even though they're clearly in the featurized module code. The desired content for the page variant is in the file myModule.pages_default.inc, in the function myModule_default_page_manager_pages().

The result upon deployment is that the Page Manager page is created, and appears in /admin/structure/pages, but the Content tab for the page variant is empty. I need the code the provide the many blocks I placed, configured, and saved within the development environment.

I've also tried exporting the entire page or just the variant and importing that, and get exactly the same results.

What code or step am I missing, please?

My setup:

Drupal 7.52
Panels 7.x-3.6
Page Manager 7.x-1.9
Features 7.x-2.10


texts:
What's the best way of creating image annotations in Drupal 7?

Ideally, I would like to re-recreate something like in Concept Feedback, where you can post annotations on an image and then display the annotations as a list below the image, grouped by category.

Image Annotate (view demo here), lets you annotate images. The annotations are also displayed as comments on the node (under the comments section). Unfortunately, it the Drupal 7 version is incomplete and not actively developed. The module also doesn't allow you much control over how comments are displayed and you can only annotate one image per a ndoe.

Photonotes (view demo here) is another similar module (although it only displays annotations on the image). It to is only in development for Drupal 6.

JQMap Highlight works on Drupal 7, only lets you post tooltips on images (as opposed to true annotations).

Does anyone have other suggestions.

Thanks!


texts: How to define specific page on hook_page_top?

texts:
I want to add some stuff to the top of the page on certain pages.

How can I specify which pages that my custom content should be included on?


texts: How do I remove the progress bar in Webform module?

texts:
I am using Drupal 7 and I have version 7.x-4.23 of Webform. When I create a Webform it is a simple one-page submission form. There is a really unnecessary "Start > Finish" progress bar right in the middle of the page. I go to Configuration > Webform Settings > Progress Bar and make sure "Show Progress Bar" is unchecked. However, even after clearing all cache and refreshing the page the progress bar is still there.
How do I get rid of this progress bar?


texts:
I am using Drupal 7. I have created a content type IMAGE with keywords, caption, headline, category populated by EXIF and I also autogenerate the label. All I have to do is select a local image and hit save and everything I need is populated from the image metadata - all good so far.

The only problem is that I cannot edit the EXIF populated fields. If  I want to move an image from one category (taxonomy) to another or notice a typo in the caption the only way I can make corrections is to delete the image, correct the text locally and reupload the image - when I select EDIT having found the content the default edit page does not show the field populated by EXIF. If I change them on the content type to a text or taxonomy field I can edit them, but I can't do that each time I want to edit a field.

I have searched but found nothing to help. Alternatively I have considered duplicating the EXIF populated fields on the IMAGE content type amd populating them using tokens from the EXIF populated fields and using those to drive my display views etc. I should then be able to edit them but it is not a very elegant solutions. (I am not sure that will work after initially trying it)

I also have an issue that I need a multi-valued field other than keywords that I can use for the category/gallery (and there isn't one in the standard it seems). That will probably be a separate question when I have solved the editing problem.

Since initially posing the question I tried using EditableViews modules which looked promising but it would still not let me edit the fields (editable version) although it did display them.


texts: Is it possible to put a single field of views in panels?

texts:
There is an existing views with a few fields output. I would like to put one of these fields in panels. Can I get it directly in Add Content of panels?

If it is impossible, what is the best way to put a single field in panels?


texts: Drupal7 Menu item 'title callback' being cached?

texts:
I defined a menu through hook_menu, and set a title callback on a menu item, like so:

function mymodule_foobar_menu() {
     $items[SOMEPATH] = array(
    'title'         => t('Drink'),
    'title callback' => 'mymodule_foobar_menu_title',
    'access callback' => (blah),
        'page callback' => 'blah',
        'type' => MENU_NORMAL_ITEM,
        'menu_name' => 'main-menu',
        '#description' => '',
        'weight'=>10
    );

and created

function mymodule_foobar_menu_title()
{
    return ($whatever)?t('Beer'):t('Wine');
}

mymodule_foobar_menu_title seems to be called for almost everywhere where 'Drink' would appear, showing 'Beer' or 'Wine' instead. Except, in the main menu itself.

I can edit the main menu (at admin/structure/menu/manage/main-menu) and I see the link mentioned as Wine (or Beer). If I edit the link, there is a textbox 'Menu link title *' that says 'Drink'.

Can someone explain how to change the text of the link, instead of all the other appearances of the title, preferably without using an extra module ?


texts: A View listing Multiple Locations and each Location having it's Own Map

texts:
I am using Google Store Locator for to list a locations, I have a use case where some of the locations have special events. I want a small map next to each listing.

I've added some items to the Store Location content type to select if that location is having an event with some other fields relevant to the event.

With that, I've created a view that shows everything I need, except for a small map of the location next to the event listing. You can see what I'm going for here:

I'm stuck on how to add the map. I know I have the location information I need in the content type, but there doesn't seem to be any "map" format I can use in the view. I'm assuming I'll need another module or something custom.Looking at OpenLayers, it looks like it adds multiple markers to one map like a lot of the other solutions, anyone know if it can do what I'm asking?

The map doesn't need to be interactive, I'd take a static image that linked out the the location in Google maps.


texts: Right now in each gallery, when a user clicks on the thumbnail, a larger version will show up in the middle of the screen. With it are arrows to navigate, a "1 of x" caption, a link to start a slideshow, and an x to close it. When I click the image, it takes me to the page of the media. What I want it to do is take me to the next image in the slideshow (like the arrows would have done). I tried looking at the configuration of the Media Gallery Module but there were only options on column and row layout. When I tried to check the settings in the gallery content type, all of the fields were locked and could not be edited. I tried Google for a solution, but not really anything turned up for this specific problem.


texts: Remove shortlink link and meta tag generator

texts:
I try to remove shortlink and generator link from my site.

<meta name="generator" content="Drupal 7 (http://drupal.org)">
<link rel="shortlink" href="http://landberg.at/nl/node/109">

I used below code in template.php but when i look in my source code its still there?

function landberg_html_head_alter(&$head_elements) {
    unset($head_elements['system_meta_generator']);
    foreach ($head_elements as $key => $element) {
        if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
          unset($head_elements[$key]);
        }
        if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
          unset($head_elements[$key]);
        }
    }
}

What is best way to remove this?


texts: Custom Entity API does not give individual fields in Views, only (sometimes information-less) rendered entities

texts:
note: I'm currently exploring hook_entity_property_info_alter and clearing the cache forcibly by truncating the cache table as I've had many iterations of work on this over the years. (Though I wouldn't recommend you trying that and if you do, back up first!)

I've defined entities in hook_entity_info. But when I have I get differing results and none of them work in Views as I was hoping.

"Paid subs" doesn't give me control of individual fields and therefore allow me to mix one field here with another of a joined entity there. But it does give fairly decent information.

This is its definition in hook_entity_info:

$info['paid_sub'] = array(
    'label' => t('Paid subscription'),
    'plural label' => t('Paid subscriptions'),
    'description' => t('company paid subscriptions (in theory
        this could be just postage or the full cover price etc.'),
    'base table' => 'company_paid_subs',
    'entity keys' => array(
        'id' => 'psid',
    ),
    'uri callback' => 'entity_class_uri',
    'entity class' => 'PaidSubEntity',
    'controller class' => 'PaidSubEntityController',
    'admin ui' => array(
        'path' => 'admin/paid-subs',
        'controller class' => 'PaidSubEntityUIController',
        'menu wildcard' => '%paidsubentity',
        'file' => 'paidsubentity.admin.inc',
    ),
    'module' => 'company_subs',
    'access callback' => 'paidsubentity_access_callback',
    'label callback' => 'paidsubentity_label_callback',
    'views controller class' => 'EntityDefaultViewsController',
);

paid subscriptions

Subscription

This one: "Subscription" doesn't do anything remotely useful.

hook_entity_info code:

$info['subscription'] = array(
    'label' => t('Subscription'),
    'plural label' => t('Subscriptions'),
    'description' => t('A subscription (as opposed to
        user registrations, paid recipients of magazines, promo readers etc.)'),
    'base table' => 'subscription',
    'entity keys' => array(
        'id' => 'sid',
        'revision' => 'revision_id',
    ),
    'entity class' => 'SubscriptionEntity',
    'controller class' => 'SubscriptionEntityController',
    'module' => 'company_subs',
    'access callback' => 'subscriptionentity_access_callback',
    'label callback' => 'susbcriptionentity_label_callback',
    'revision table' => 'subscription_revision',
);

Is it because I have been overriding default configurations? What's the cause? Ideally I'd like to be able to select individual fields within an entity rather than having to rely on a rendered entity because I'd like to be able to select one field from one entity and another from another entity by using joins in hook_views_data_alter, like this (which worked just fine until I stopped defining each field in hook_views_data and turned the bespoke tables into entities specifically to try and utilise the extra functionality of core and contrib modules etc.):

$data['subscription']['user_id']
['relationship']['handler'] = 'views_handler_relationship';
$data['subscription']['user_id']
['relationship']['base'] = 'users';
$data['subscription']['user_id']
['relationship']['base field'] = 'uid';


texts: User Registration to provide password on registration pg administrator approval and verification email

texts:
[I tried looking for similar answers, I just got this: Administrator notification on user registration

For user registration I want:
1) Password and Confirm Password field on Registration page
2) Admin approval for account creation
3) Verification Email to be sent to the user

* For `Who can register accounts?` the setting says : `Visitors, but administrator approval is required`.
* I've installed the package "User registration password" to have password on registration page as well as getting a verification email sent

Problem: If I don't enable "Admin Approval" registration works fine. The user account is created immediately and it gets a verification email with a link which can be used to confirm the account.

If I enable Visitors, but administrator approval is requirednothing works. User account is created, but it doesn't get a mail, admin doesn't get a mail and account is not activated.

Am I supposed to create a trigger?


texts: How to cache a view for all users of a role?

texts:
I have a view that displays a map. I need to display 7000 entries on the map.
I have installed solar search API to index the content and have created a view using that.
Still, the loading time for that view is around 1 minute for each user. After the first fetch, then it loads fast for that user since it fetches the data from the cache.
I was wondering whether I can cache the entire view for all users of a specific role.
I tried installing the "Views Custom Cache Tags" module.
But I am a bit lost on how to configure it.
Also not sure whether this will solve my problem or not.
Suggestions, please.


texts: Add a popup text link to a specific "create content" page

texts:
I've looked everywhere and can't find an answer to my problem. I'm trying to do something that seems like it would be relatively simple, but I keep coming up empty: add a pop-up text link to the "node/add/content" form for just one of my content types.

I've figured out how to use the popup module (https://www.drupal.org/project/popup) to make pop-up text elements using blocks, but that won't help me when it comes to the add content page. The idea here is to give users instructions on how to fill out the "add content" form on the form itself. Since I'm using an overlay screen, it makes the most sense to include the link directly on the form itself.

I've seen many places where people suggest a variation on this: Base tpl file for "add content" page?. In other words, copying the node file contents to a new file called page--node--add--my-content-type.tpl.php in the base theme directory, but this has no effect for me.

Also, I've tried to use the Theme Developer module to figure out what the page is called, but enabling this module just breaks the form for me, rendering Devel useless.

Do I need to somehow manipulate the template.php file in my theme? Any direction anyone can give me would be great. Thank you in advance.


texts: Tabledrag in grid shape for media form field widget thumbnails

texts:
I am looking for a way to change the tabledrag into a grid shape. A nice looking solution for drag-and-drop uploading files and sorting them in a way that jquery sortable does. It should end up to be something like the uploaded thumbnails in Facebook's status update form.

Looks like I'll end up writing a custom solution from scratch like the one here: jQueryUI Sortable + HTML5 File API examples?

Can you show me a starting point or do you know about any work has been done so far?


texts: Views pager labels translation per context

texts: Now that I finally have managed to have Views pagers appear, I'm wondering how I could change the strings collection (prev, next, first, last...) per View. That's because in a View that displays items in chronological manner, I would rather see labels like older/newer rather than previous/next. Can this be done somewhere in views template or in template.php? (No jquery here, please :))


texts: What is the equivalent of hook_translated_menu_link_alter() to alter a menu link?

texts:
I want to alter the menu link in Drupal 8. In Drupal 7 we can achieve this using hook_translated_menu_link_alter().

function module_translated_menu_link_alter(&$item, $map) {
  global $user;

  if (!empty($item['access'])) {
    // Administrator will access all menu's.
    if (strpos(current_path(), 'admin/structure/menu/manage/' . $item['menu_name']) === 0 && user_access('administer menu')) {
      return;
    }
    // If userid is equal to menu user id.
    if ($user->uid == 1) {
      $access = 'UNBLOCK';
      break;
    }
   // Block menu.
    else {
      $access = 'BLOCK';
    }
    // Access FALSE if Menu not for USER.
    if ($access == 'BLOCK') {
      $item['access'] = FALSE;
    }
  }
}

In Drupal 7 I am hiding/disabling menu based on some conditions like the user ID.

Similarly, I want to alter the menu link in Drupal 8. How can I achieve it?


texts: drupal_mail() strips all html tags from emails

texts:
So as the title explains, when sending an HTML email with drupal_mail(), email comes with no HTML tags.

    $module = 'module';
    $key = 'contact_message';
    $language = language_default();
    $params = array();
    $email = 'sender@email.com';
    $from = variable_get('site_mail', 'admin@example.com');
    $send = TRUE;
    $message = drupal_mail($module, $key, $email, $language, $params, $from, $send);
    $message['headers']['Content-Type'] = 'text/html; charset=UTF-8';
    $message['subject'] = 'Test';
    $message['body'] = array();
    $message['body'][] = 'Testing anchor in mail';
    $system = drupal_mail_system($module, $key);
    $message = $system->format($message);
    $message['result'] = $system->mail($message);

And when recieving the email, and viewing the source:

Message-Id: <201305090722.r497MLAV005654@test.server>
X-Authentication-Warning: testserver : www-data set sender to sender@email.com using -f
To: from@email.com
Subject: Test
X-PHP-Originating-Script: 1000:system.mail.inc
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
Sender: sender@email.com
From: from@email.com

Testing anchor in mail [1]

[1] #

So you can see that any HTML tags were stripped.
And it doesn't matter what HTML tags I put in body.

I thought it might be related to Text Fomats, but I have "Filtered HTML" and "Full HTML" active filters with any permissions.

The thing confused me were the Ubercart invoices. At first they were sent with HTML, and then at some point it stopped. They were received plain text.
After digging a bit @develkar answer, I've found this in one of ubercart updates:

/**
 * Installs HTML Mail System for Ubercart.
 */
function uc_store_update_7004() {
  // Set mail handler for all Ubercart modules
  variable_set('mail_system',
    array_merge(
      variable_get('mail_system', array('default-system' => 'DefaultMailSystem')),
      array(
        'uc_cart'  => 'UbercartMailSystem',
        'uc_order' => 'UbercartMailSystem',
        'uc_file'  => 'UbercartMailSystem',
        'uc_roles' => 'UbercartMailSystem',
        'uc_stock' => 'UbercartMailSystem',
        'uc_store' => 'UbercartMailSystem',
      )
    )
  );
}

I guess that at some point, one of installed modules (I suspect SMTP module) overridden this variable, and that's why emails were coming plain text.
After running this update manually again, Ubercat invoices are HTML again.

For the rest of emails, I'll have to install some modules as suggested in other answers.

Thanx.


texts:
I'm creating a custom module. This module displays public custom content without node and views . For this content custom page , I would like to add dynamic meta keyword and meta description .

I have read this excellent answer
How do I add a meta tag in <head>...</head> section?
and it said we can use

mymodulename_page_attachments(&$page)

and update variable

$page

But the meta contents are getting in a controller's method. For this raison, I would like to
pass the meta contents to mymodulename_page_attachments hook.

How can I call and update $page in my controller module to do this ? Or how can I generate meta in my controller ?


texts: How to make a direct admin-visible URL to a private file in: sites/default/private/

texts:
Say I have a file in sites/default/private/archive/20160221.csv

How do I make a direct full URL to this file for admins to download.

I looked at file_create_url but am not sure what it would require to be passed in:

https://api.drupal.org/api/drupal/includes%21file.inc/function/file_create_url/7


texts: Drupal7 : Error in install drupal in localhost

texts:
When install drupal 7 in my localhost its show this error:-

http://im36.gulfup.com/QFe3q.png

why its not show me database type [ MySql ]

when install in my site and install good and return install to localhost show my this error

 Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in D:\AppServ\www\drupal\includes\database\mysql\database.inc on line 46


texts: Remove all styling from views field view?

texts:
I am using the views-field-view module to output the number of teachers I have in each school, so it's just a plain number. The parent view that this child view is embedded in is a table with some other information (see screenshot).

Is there a way for me to remove any and all formatting from the child view so that the final output looks like it's all coming from one view? As you can see in the screenshot, there is some misalignment with the numbers, and there is also a weird line above the numbers coming from the embedded view.

http://screencast.com/t/cFi0ctcZS

Thanks in advance!

Lukas


texts:
I want to show a modal popup in drupal 7. On searching the web I came to know that it can be done using the ctools module itself. Here is the code I tried:

function codeexpertz_menu() {
  $items['codeexpertz/%ctools_js/page'] = array(
    'title' => 'Demo CTools Page',
    'access callback' => TRUE,
    'page callback' => 'codeexpertz_ctools_page_example',
    'page arguments' => array(1),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function codeexpertz_ctools_page_example($js) {
  $output = "Sample CTools popup functionality for Demo purpose.";
  if ($js) {
    // Required includes for ctools to work:
    ctools_include('modal');
    ctools_include('ajax');
    return ctools_modal_render("Demo", $output);
  }
  return $output;
}

The link i referred is here

I added Modal Window to my page.tpl.php file directly for now to test it. However when I click on the link I get redirected on the destination page rather than showing the content in a modal.

I tried this is a fresh installation also, but all in vain.


texts: Why is it not recommended to change the default language?

texts:
I have a fresh installation of Drupal 8.2.5 and want to use it for mostly Spanish content, but keeping the admin interface in English. /admin/config/regional/language says,

  It is not recommended to change the default language on a working site.

And /admin/config/regional/language/detection/selected says,

  Changing the site's default language itself might have other undesired side effects.

What will break if I change the default language? Or is a better question to ask, should I want to change the default language? I found this question, but it does not answer my question, aside from also being pre-Drupal8.

Thanks.


texts: The version of CKEditor could not be detected

texts:
Possible Duplicate:
  CKEDITOR not working Drupal 7

When I try to enable CkEditor, I get the following error.

I have already extracted the files in sites/all/libraries/ckeditor.

Is there any problem with the version of this module? How can I fix this?

I have already read Ckeditor doesn't work.


texts: Manually including Webform in a single node

texts: Anyone know how to include Webform module into a single node?  Is there a function I can include to do this.


texts: Generate consecutive number as title using auto_nodetitle?

texts: I need that new submissions for an specific content type have a consecutive number as title. Found auto_nodetitle, but I don't know how to make it a consecutive number, they don't give clear instruccions as how to program it. I'm fairly new to Drupal.


texts: How do I store editor-configurable snippets of configuration?

texts:
The Drupal 8 site I'm building contains some custom forms and pages. On those pages, bits information are inserted that must remain editable by the site editors. In D7, I would probably have used the Variables module for this. There are a couple of options, but none of these seems the ideal solution.

Possible solutions:

Use the State API.
Pro: Does not revert on a config-import.
Con: Not really meant for this kind of data.
Use the Config API.
Pro: Easy to deploy initial values.
Con: Needs something like Config Ignore to protect the data from being reverted on a config-import.
Create a node type for this kind of information.
Pro: Provides a well-known admin UI be default.
Con: Lots of overhead for storing a simple value. No native machine name to reference the value.

Question:
How should I store snippets of editor-configurable information, so that it can be retrieved by a machine name, and will not be reverted when a developer does a config import?


texts: How to refresh a coded block when a flag is clicked in it?

texts:
I have created a block in which I display a flag. All of it is done programatically. The content of the block changes depending on the flag status, but when a user clicks on the flag, it does not refresh the page or the block. The content is currently refreshed only when I reload the page.

I have gone as far as to create a callback from my block module to a jquery file, but I do not quite know where to go from here. I am not familiar enough with jquery to fully understand what to do, and how to use the callback function. Here is what I have thus far in my .module file:

/**
* Implements hook_init().
*/
function mymodule_init() {
drupal_add_library('system', 'drupal.ajax');
}
/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items = array();

$items['block/reload'] = array(
  'title' => 'Refresh block',
  'page callback' => 'mymodule_refresh',
  'access callback' => TRUE,
  'type' => MENU_CALLBACK,
);

return $items;
}

/**
* Menu callback.
*/
function mymodule_refresh($action, $type) {

}

In a .js file which I have put in a folder 'js' in my module's folder, I have created this:

(function($){

$(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {

}

});

})(jQuery);


texts: How to give blocks a meaningful name in the views overview page?

texts:
I think, the image will speak for itself:

I have tried the block & display titles, the block name & also the new administrative comment field. Still the views overview looks not very informative.

Thanks!


texts: What tools do I need to automate my Drupal workflow?

texts:
What tools do I need to automate the following tasks:

Project setup

Generate project wide password
Setup prod domain and dev and stage subdomain on server
Create user with access to /bin/bash/
Add public keys
Change open_basedir and increase memory limit
Delete files in document root
Initialize Git repo on Git hosting
Clone Drupal Repo Recursively
Add .gitignore (including Mac, Drupal and SASS specific paths)
Create Zen/Omega Subtheme
Create drushrc.php & aliases.drushrc.php
Commit changes
Create dev branch
Add Git remote and Push the branch master to it
Create databases for prod, stage and dev
Run site-install
Setup cron
sql-sync and rsync from prod to stage and dev
Fix file permissions


texts: Drupal 6 Apache Solr Search Problems with result ordering & fields

texts:
As I am implementing a website made in Drupal 6 and using Apache Solr search as the search application in the website.

Drupal Version 6.22
Apache Solr Version : 3.6
Apache Solr Module: 6.1.x

Below are the two problems I am facing.

While searching a particular content the business requirement is to search only in the Title field, Body field and in the Terms attached in a node. How can I achieve that?
I have used the HOOK_apachesolr_modify_query() in some other purposes. Do I have to mention all the filters here again? like,

mymodule_apachesolr_modify_query(&$query, &$params, $caller) {
   $query->add_filter('title', $keyword);
   $params['fl'] = 'title';
}

The second is that once the contents are being searched as per the requirement I should get the result based on the following algorithm.

1st result = (Match in Title + Match in Body + Match in Terms names) (Keyword present in all)

2nd result = (Match in Title + Match in Terms names) (Keyword only present in title & term names)

3rd result = (Match in Title + Match in Body) (Keyword present in Title & Body)

So I added a boost factor from the Apache Solr admin section as
Title = 1.0
Term = 0.50
Body = 0.25

But the ordering is not maintained.

I even also mentioned

function mymodule_apachesolr_modify_query(&$query, &$params, $caller) {
   $params['qf'] = array('taxonomy_names^0.50', 'title^1.00', 'body^0.25');
}

But no effect. Please suggest any ideas.
Help me on these issues, I am really stuck here :(


texts: The results within the page results do not lead to the nodes

texts:
I do not know how to treat this problem with Drupal. I hope you can help me.

Suppose this. We have a glossary (Views), which shows the items of the content type called "Glossary".

I created a search engine Views, following these instructions.

Now, I open my website and try to find one of the words of my glossary site.

Result: Well, the results page returns the title of one of the nodes of content type "Glossary", good! If I click on that word, then word node (which belongs to the glossary) is displayed.

But I do not want the node is displayed. I want that word is displayed within the glossary. Glossary nodes should not be viewed independently.

Is it possible that the word shown in the results page glossary is leading the glossary, and not their respective node?

Thanks in advance.


texts: Taxonomy term option is missing in view category

texts:
I have several site on Drupal 8.5  where I don’t see the "taxonomy term" option in view. So I can’t create a view that lists taxonomy terms of a vocabulary.

See the first screen shot to see the problem.

Why I don’t see this option ? Is there something to install or enable ? I’ve checked a lot of things and I still don’t understand.

Below, there is a second screen shot of an other Drupal where I have this really useful field.

Finally, this is what I would like to add in fields and Filter in view.


texts: Add entity reference field to content type

texts:
I have 2 content type 1.Employee performance 2.Task

Task content type has a field that assign users to the task (Assigned To Users).Each employee has a node in  Employee performance content type and he is the author of the node. How I can add a select list field in Employee performance that display all the tasks that assign to the employee(author) by using entity reference field in view?


texts: Unique Value validation rule does not show the indicated message

texts:
I have a Unique Value rule for a field. The rule applies correctly and the offending field gets highlighted in red but it doesn't show any messages !

I have other validation rules on the same field (must be a number, minimum, maximum etc) and they behave correctly i.e field is highlighted in red and the indicated error message appears.


texts: Reloading option in a select list with ajax

texts:
So here is my problem:

I have a form so users can create orders. There is a 'Client' select list where they can select the client of the order. When we select a client, we use ajax to load client info (address, tax rate, discount ...) and populate some field. This works fine.

I am now adding a feature to be able to create directly a client from the order, in a modal.
So I have a button in the order form, that triggers ajax to open a modal and render the new client form:

  $account_form = drupal_get_form('mymodule_creation_account_custom_form',$form['field_client']);
  $output = drupal_render($account_form);

  $commands = array();
  $commands[] = ajax_command_invoke('div#createClientModal','foundation',array('reveal', 'open'));
  $commands[] = ajax_command_replace('#new-account-form-placeholder',$output);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );

Then I fill in the info, and submit the account from the modal:

  $account = my_module_new_account_form_submit($form, $form_state);

  $form['client_hidden_field']['und']['#options'][$account->nid] = $account->title;
  $form['client_hidden_field']['und']['#default_value'] = $form['client_hidden_field']['und']['#value'] = $account->nid;

  $commands = array();
  // Closing the modal
  $commands[] = ajax_command_invoke('div#createClientModal','foundation',array('reveal', 'close'));
  $commands[] = ajax_command_replace('.field-name-field-client', render($form['client_hidden_field']));
  $commands[] = ajax_command_invoke('.field-name-field-client select','change');

  // Replace the form with an empty div
  $commands[] = ajax_command_replace('div#account-form-wrapper','

');

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

So what I am doing in this last submit, is creating the new account (that works), it returns me the nid. Then, as I have stored in a variable ($form['client_hidden_field']) the client field, I update it with the new option, select the option, replace the old client select list with the new one, and trigger change to call the old callback that loads a client info when it is selected.

I have tried lots of thing and each time I select the new client created, I get an 'Illegal choice'. I have tried without default value, without triggering a 'change', in JS with a command_invoke and nothings seems to work.

The only success I had was :
I do all these step, I manually select a client (one already existing before), and then select the new one. After that I didn't have the 'Illegal choice' and was able to save. But this is not a way to make it work.

If someone has any idea, I would love your help !

Thanks

Ed


texts: How do I add fields to views contextual filters

texts:
I have created a view definition based on a custom table I have.  I have happily been creating simple views.

I would like to create a view with a contextual filter, but wwhen I click on it the only field being listed is my main ID field.  I would like to filter on another field.  How can I add a field to be added to the contextual filters selection?


texts:
I'm trying to insert a new line in message body using \n but it's not working.
Tried already with \r\n and it doesn't work also.

Any help?

Tks.


texts: How to automatically add module dependencies to feature with Ctools exportables?

texts:
I created an API module with a hook_schema(), where one table has an 'export' key to make the entries exportable with ctools (as features).

Now specific entries of this module may depend on specific modules. I would like these module dependencies to be added automatically to a feature exported this way.

Any idea how this is done?


texts:
I have made a form in D7 using form API,submitted values to that and retrieved entries from database;now what i want is to add a delete link in front of every retrieved row.My retrieval code is:

function form_data_menu() {
$items['formdata'] = array(
'title' => 'Form Data',
'page callback' => 'form_data_form',
'access callback' => TRUE,
);
return $items;
}
function form_data_form()
{
 $results = db_query('SELECT * FROM {drupal}');
 $header = array(t('Id'),t('Name'),t('College'),t('Education'),t('Percentage'),t('Application'));
$rows = array();
foreach($results as $result){
$rows[] = array(
$result->id,
 $result->name,
 $result->college,
 $result->education,
$result->percentage,
 $result->application,
);
}
return theme('table',array('header'=>$header,'rows'=>$rows));
}

any help will be appreciated. Thank You!!


texts: Bulk Delete Custom Entities (Not Entity Types)

texts: I have a 5000+ entries for custom Entities created by the RedHen module (https://drupal.org/project/redhen). I want to wipe them completely from the system (they are all test entries). How can I do this quickly? I tried to get Views Bulk Operations and the Delete All modules but neither seem to be picking up the custom entities.


texts: Configuring a paid membership with subscriptions website with commerce module

texts:
I'm struggling in finding out a solution to provide membership access on my website with subscriptions renewed automatically depending which product/license they bought: 1-month membership, 3-month membership or 6-month membership.

After a few days of research I am trying to implement Drupal Commerce 2.x Module, following exactly these steps: https://docs.drupalcommerce.org/commerce2/developer-guide/recurring/getting-started.

So I've configured the payment gateway, the billing schedule, created the product variations as in images shown below, but I can't edit the products to work as a license type, because I receive this error:

So, the workflow would be like this:
1. Users registering accounts
2. Users buying appropriate product: 1-month, 3-month or 6-month membership
3. Users got access based on membership role to premium content


texts: How to show fields in the Inline Entity Form display widget?

texts:
I've just started with Inline Entity Form and seem to have it working with a custom entity type that has fields. My problem is, none of these fields show in the Inline Entity Form widget, it just shows an empty ID column and Edit / Delete buttons:

I've looked through what little documentation there is, and browsed related issues and questions, but they all seem to be doing things more complex than what I'm trying to do.

Is there any simple way to just choose a field or two to display in the Inline Entity Form widget?

It seems to "just work" for nodes - how can I have it pick up the entity fields in a similar way?


texts: How to structure git repositories for project?

texts:
I'm working on a content synchronisation module for Drupal.  There is a server module, which sits on ona website and exposes content via a web service.  There is a also a client module, which sits on a different site and fetches and imports the content at regular intervals.

The server is created on Drupal 6.  The client is created on Drupal 7.  There is going to be a need for a Drupal 7 version of the server.  And then there will be a need for a Drupal 8 version of both the client and the server once it is released next year.

I'm fairly new to git and source control, so I was wondering what is the best way to setup the git repositories?  Would it be a case of having a separate repository for each instance, for example:

Drupal 6 server = 1 repository
Drupal 6 client = 1 repository
Drupal 7 server = 1 repository
Drupal 7 client = 1 repository
etc

Or would it make more sense to have one repository for the server and another for the client then create branches for each Drupal version?

Currently I have 2 repositories: one for the client and another for the server.


texts:
Is there a way to add GA per theme. The reason for it is I am using themekey to switch the theme for mobile users.

I have read that it is possible to add more than one tracking code on a site but would like to split them between Main and Mobile.


texts: How to create an average out of 3 Fivestar Fields?

texts:
I want to create a Fivestar-Field which shows the average of 3 other ones.

Something like:

(Field A + Field B + Field C):3 = Field D

A,B and C are Fivestar-Fields which rate something and Field D is the average value out of the three.

I want the average to be showed via the star-widget of fivestar.

Is there a way to do that?

(I use Drupal 7)