texts:
I created a custom module and in the code below the button is not rendered, there is only the text :

$form = ['#markup' => '<button type="button" class="btn btn-success" disabled="disabled">Product unavailable</button>'];

How to display the button?

<?php

/**
 * @file
 * Hook implementations of commerce_add_to_cart_access module.
 */

use Drupal\commerce_product\Entity\ProductType;
use Drupal\commerce_product\Entity\ProductVariationType;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;

function commerce_add_to_cart_access_form_commerce_order_item_add_to_cart_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // Your original code to get store owner.
  $current_store = \Drupal::service('commerce_store.current_store');
  $owner = $current_store->getStore()->getOwner();
  if (!$owner->hasRole('marchand_premium')) {
    // Overwrite the whole form markup!
    $form = ['#markup' => '<button type="button" class="btn btn-success" disabled="disabled">Product unavailable</button>'];
  }
}


texts: How do I store URL parameter in user registration field?

texts:
I'm trying to store a url variable into a field on the user registration page.

http://domain.com/user/register?aid=74

Can I use javascript to pull that variable and store it in one of the input fields?


texts: Comments not showing up when set to open and assigned a region in manage display in drupal 7

texts: I just set my comments for my content type to "open" and assigned the comment field to show up in the full content manage display. But it doesnt show up when viewing in my full display node. I tried changing the theme and it still doesnt show up. How can I debug something like this?


texts:
I've created View with list of entity registrations. This list display users registered for events with info, like conference name (node title), user name etc.

Is it possible to add filter, which contains list of all existing conference names by default? Because right now I have to add values manually.


texts: Drupal Hook_Mail_Alter Custom Template fields

texts:
We have a Drupal 6 contact us Webform with e-mail.  There is a custom template with the following fields:
Facility: %value[facility]
First Name: %value[first_name]
Last Name: %value[last_name]
Email: %value[email_address]
Phone: %value[phone_number]
I wish to be contacted: %value[contact_user]
Subject: %value[subject]
Comments: %value[comments]
The results of this submission may be viewed at:
%submission_url

I want to access both the subject and the facility field.  I'm not sure my keys are correct using "headers".  Is this the correct way to access both the subject and facility fields?

Here is my code in the custom module test:

test_mail_alter(&$message)
{

    if (($message['id'] == 'contact_us'))
    {
        $mail_listing = array();

        // pick up subject e-mails
        $subject = str_replace(' ','',$message['headers']['subject']);
        $subject_listing = explode(',',$subject);
        foreach ($subject_listing as $s){

            if (preg_match('/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/',$s)){
                array_push($mail_listing,$s);
            }

        }

        // pick up facility if it exists and combine it with the subject listing
        $facility = str_replace(' ','',$message['headers']['facility']);
        $facility_listing = explode(',',$facility);
        foreach ($facility_listing as $f){

            if (preg_match('/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/',$f)){
                array_push($mail_listing,$f);
            }

        }

        $message['headers']['to'] = implode(',',$mail_listing);
    }
}


texts: How to set an action to unpublish a comment with rules?

texts:
The rules modules has default actions setup to unpublish nodes but not comments.
Do I need to use PHP to unpublish a comment?


texts: How to redirect search result page in drupal

texts:
Here, I am working in drupal Commons plugin. I already customized search form in that drupal header.Here i include modify search form in custom theme:

function mytheme_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#title'] = t('Search'); // Change the text on the label element
    $form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty
    $form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield
    $form['custom_search_types']['#attributes'] = array('style' => 'display:none'); // Set a default value for the textfield
    $form['search_block_form']['#attributes']['class'][] = 'form-control'; // Set a default value for the textfield
    $form['actions']['submit']['#value'] = 'OK!'; // Change the text on the submit button

    $form['actions']['submit'] = array('#type' => 'button','#value' => 'OK!');

    // Add extra attributes to the text box
    $form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}";
    $form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";
    // Prevent user from searching the default text
    $form['#attributes']['onsubmit'] = "if(this.search_block_form.value=='Search'){ alert('Please enter a search'); return false; }";
    $form['actions']['submit']['#attributes']['class'][] = 'input-group-addon';

    // Alternative (HTML5) placeholder attribute instead of using the javascript
    $form['search_block_form']['#attributes']['placeholder'] = t('Search');
  }
}

And i need to redirect search result page using that above search form.But I type content and hit enter it remain same page.How to redirect into search result page with custom form values.I just customized form submit in custom theme

function mytheme_search_box_form_submit($form, &$form_state) {
print_r($form);//No results
}

How to achieve it. kindly guide me..


texts: Best way to allow multiple users to edit a node but require approval?

texts:
I am looking for a way to allow multiple "normal users" to suggest changes to existing nodes, but only once they are approved by admin, should they take effect. I am not sure how this would work in the case where multiple users make changes, but if stackoverflow and drupal stack exchange can do it, I'm sure it must be possible.

I had a look at Node Changes, but its not technically ready. Is that the only option available to me?


texts: text_format field value not appearing in full_html mode

texts:
I'm using a block plugin to display content based on what the user inputs into a form. Select boxes, and radio buttons are saved and displayed in the form just fine but the text_format field isn't working the same way.

public function blockForm($form, FormStateInterface $form_state){

    $form['bodytext'] = array(
      '#type' => 'text_format',
      '#title' => $this->t('Block contents'),
      '#format' => 'full_html',
      '#description' => $this->t('This text will appear in the block.'),
      '#default_value' => $this->configuration['bodytext-submit'],
    );
}

public function blockSubmit($form, FormStateInterface $form_state) {

    $this->configuration['bodytext-submit']  = $form_state->getValue('bodytext');
}
public function build(){

    return array(
        '#title' => '',
        '#type' => 'markup',
        '#markup' => '<div>' . $this->configuration['bodytext-submit']['value'] . '</div>',
    );
}

Anything input into the text_format element in the form is saved properly but when returning to the form, the field is empty unless the format is set to 'basic_html'.
So I know the values are being saved, and are even presently available in the configuration form of the block. It simply isn't displayed in 'Full_html' mode.


texts: advantages of drush bam vs. drush sql-dump / drush sql-connect

texts:
Is there any comparative advantage in terms of best practice, ease of use, or speed in terms of using the drush back up and migrate command (drush bam) or is it just preference?

I'm often using just a simple drush sql-dump > exportdb.sql and a $(drush sql-connect) < importdb.sql to backup a database. I find it pretty easy to use.


texts: Update packages conflicting with core update

texts:
When updating drupal core via composer, you often get problems like:

  Problem 1
      - Installation request for drupal/core 8.8.2 -> satisfiable by drupal/core[8.8.2].
      - Conclusion: remove typo3/phar-stream-wrapper v2.1.4
      ... (and so on)

How can you tackle these issues before updating core?


texts: Ubercart Ajax change attributes on checkout

texts:
I want to change the Product Attributes on checkout page by ajax. But when I save it by uc_order_product_save() in my ajax request and go to the preview step the attributes are gone.

It seems that preview step retrives the $order from form storage but not mine saved order. It is here:

function uc_cart_checkout_form_validate($form, &$form_state) {
$order = $form_state['storage']['order'];

How can I access to the storage order object in form to save attributes?

Thanks.


texts: Commerce- Show the attribute label instead of product title?

texts:
Drupal Commerce add-to-cart attribute dropdown list shows product titles, instead of label of the attribute.

One thing that could be causing this is two product types with the same attribute field on the product display. This is required as one product is downloadable and requires a different product type than the second product type used for shippable items.

Is there a way to change the dropdown to contain attribute labels?

Current: https://www.dropbox.com/s/ib03wn7qd7hpwqm/add-to-cart-dropdown.png?dl=0
Desired: https://www.dropbox.com/s/5js29glqqbxuqiz/desired-dropdown.png?dl=0

Drupal Commerce 7.x-1.13


texts: How do you output and modify the Content:Path variable using field:PHP global?

texts:
I'm trying to modify the content:path variable using PHP field in Views for Drupal 7. The $data and the $row->path gives a blank result. Anyone know why?

It seems that I can grab it via the $views variable, but i have to dig deep into it in order to find it. Is there an easier to to access the content:path field via PHP in views?


texts: Can I use sites.php to resolve subdomain on my multi-site installation?

texts:
I have a Drupal multi-site setup on Ubuntu.

One of the multi-sites is cyber.site.edu.

Our requirement is to have another virtul host named cyber1.site.edu.

cyber1.site.edu should also resolve to cyber.site.edu

Can I use example.sites.php? I read the documentation at this link but it is not clear to me.

Any help would be appreciated.


texts: search form shows up any region but navigation

texts:
So since the search form does show up in any other region it means that the module is enabled, there is a search-block-form.tpl.php somewhere doing it's job. It also means the permissions for the search box are ok.

I went inspecting the navigation menu, within the

 to see what HTML would be there and there is no HTML to found for the search form there.
The search block is not the only block in the navigation region, there is a main menu block in there as well which shows it's menu links in the navigation region just fine.

The site has a fully customized theme and but with template files. The template files are page.tpl.php, node.tpl.php, block.tpl.php, html.tpl.php and an empty template.php file. None of the template files have been modified except for the page.tpl.php where the site logo is hardcoded as

        <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
          <img src="<?php print $base_path.$directory; ?>/css/images/site-logo.png" alt="<?php print t('Home'); ?>" />


texts: Set a block region from the block edit page

texts:
I used Drupal since 4, and it always bothered me that the the block edit page doesn't include block region settings. One must return to the Blocks list to change that. It would be so much nicer if the block edit page included the region options, when using the contextual Configure links on the page.

There is no module dedicated to this on Drupal.org, so maybe there is a good reason for not doing this, like a technical limitation. Or maybe this is not useful to anyone else but me.

Is there a module for setting the block region from the block edit page? I'll create one if there isn't.

Thanks.


texts: Display images of a specific content type in a lightbox when vocabulary is clicked

texts:
Background
I am using Drupal 7 and I have a taxonomy "Kitchen Type" and content type "Kitchen Picture" having default field_image for images. There are three Kitchen Types Traditional, Contemporary and Transitional. I have more than 10 Kitchen Pictures assigned to each Kitchen Type.

Problem
I have a view at /kitchens (Page 1) that lists three kitchen types and when clicked, lists the Kitchen pictures (another dynamic view) (Page 2). When a picture is clicked a lightbox open up. But,  I would like to have a lightbox open up with kitchen Pictures (including next-back navigation) when any of the kitchen type (traditional etc) is clicked. So, I want to skip Page 2 actually. I have no idea how to go about it. Any help would be appreciated.

Edited
I am afraid I also have a link in the header "Kitchen Portfolio" that supposed to open a lightbox and allows visitor to navigate through all the kitchen pictures. I want to avoid loading all the images on all pages. I need a way out such as when link is clicked it loads the html and start lightbox navigation. I do not know how I can achieve it in Drupal.

I already have lightbox2 installed.

Thanks


texts:
I made a view ("exampleview") that needs an argument: myarg. I can load my page at "exampleview/myarg" and at "exampleview".

When I call drupal_goto(exampleview/myarg), the destination is only "exampleview".

I get the same result with $arr = array('exampleview','myarg');.

Can anybody help me?


texts:
I'm using an exposed filter in views to find nodes that contain that word in the body field.

I would like to show that word in the body in bold.


texts: how to update a field created with field_create_instance

texts:
I'm building a module which implements hook_enable to create fields.
But as I'm developing I noticed a error in my code causing fields to be created in a wrong way.

Is there a way to update these fields?
preferably using code so I can also use this code to hide these fields from lets say a user profile once the module is disabled.

here's my code that I used to create those fields:

//calling my function
popover_create_user_field('field_firstname', 'Voornaam', 'textfield', 1);

/**
 * field creator helper function
 */
function popover_create_user_field($field_name, $field_label, $field_type, $visible_on_registration_form = 1) {
    // Check if our field is not already created.
    if (!field_info_field($field_name)) {
        $field = array(
            'field_name' => $field_name,
            'type' => 'text',
        );
        field_create_field($field);

        // Create the instance on the bundle.
        $instance = array(
            'field_name' => $field_name,
            'entity_type' => 'user',
            'label' => $field_label,
            'bundle' => 'user',
            // If you don't set the "required" property then the field wont be required by default.
            'required' => TRUE,
            'settings' => array(
            // Here you inform either or not you want this field showing up on the registration form.
                'user_register_form' => $visible_on_registration_form,
            ),
            'widget' => array(
                'type' => $field_type,
            ),
        );
        field_create_instance($instance);
    }
}

Lets say I want to update the user_register_form visibility to 0 so it will be hidden.


texts: Manage Display page not displaying anymore

texts:
I set (or at least tried to) my user display page (admin/config/people/accounts/display) to use DS 1col on friday and part way through the request my computer crashed out (the server is running on the local machine too) and now I can't seem to access that page if I let it run forever I get:

  Fatal error: Maximum execution time of 120 seconds exceeded in /Applications/MAMP/htdocs/modules/field_ui/field_ui.admin.inc on line 145

I've tried to:

Clear caches
Run cron
Disable and re-enable DS

Although I'm continuing to play with DS, I'm assuming whatever got corrupted is related to the field_ui module because of the error and it only seems to be affecting the manage display for the user account page; no other user account pages or manage display pages are affected.

Does anyone know if there is a simple way to reset that page to the default?


texts: Getting the uid instead of the pid with profile2

texts:
I would like a function that allows me to have the same uid and pid with profile2 for each user but I don't know how I can do that.
I'm trying to make a function which allows me to return a list of users according to certain criterias. For exemple, user A, B and C each has can choose one color among a list of colors. User A and B choose the red color and User C choose Blue. The entity id for this criteria is the same as the profile2 pid. After that I get back the list of users with the function user_load_multiple($userlist) and then show the list but it shows the list according the uid and not the pid and that's what I want to change. Sorry for my poor english.


texts:
I have a Drupal 7 site and I'd like to be able to add an HTML link to part of the title of a node. By default Drupal has this as plain text. Is there any way that I can allow HMTL?

Example:

This is a title


texts: How do I organize content based on date field in a Y > m > d hierarchy?

texts:
In essence, I want to organize content based on a date field; first by year, and once a user clicks a particular year, it goes to months, and so on... possible?

For instance,
-2017
-2016
-2015

I click on 2016 views generated date link, I should see the following on the next page.

December,
November, etc...

and finally, if I click on November, I will get to the actual listing of content for November.

Edit:
I have already tried grouping by year, and then months. But it is not creating the hierarchy I am expecting. Should I create a display that groups content by years first? and then months?


texts:
I have a clean installation Drupal7.

In page Modules -> Install new module -> Upload a module or theme archive to install I select views-7.x-3.7.tar.gz (previously downloaded from drupal.org) and click button "install". Drupal redirect me to the same page, but with another design. I once again select file and click install. I get WSOD.

Important, that is a clean installation drupal, and I try purge and install it repeatedly and get same error. In php.ini:

max_execution_time = 180
max_input_time = 180
memory_limit = 256M

in index.php:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

in .htaccess i add "RewriteBase /", but this not solve problem

Before installation, I "chown" drupal folder to "www-data" (xubuntu start apache2 as this user), and dont create any folders - drupal create it himself.

this article cannot solve problem drupal.org/node/482956

HMP

upd:

/var/log/apache2/access.log - http://bpaste.net/show/261459/

/var/log/apache2/access.log - http://bpaste.net/show/261473/ (another version)

/var/log/apache2/error.log - http://bpaste.net/show/261480/

upd2:

now i create VirtualboxVM, and install drupal there. Module succesfull installed. How I can find, why on host-system module not installing? Which what settings may be different?


texts: Node gallery colorbox / lightbox etc language problem

texts:
Colorbox doesn't work with Drupal Node Gallery module when the site language is set to anything other than English.
When the language is switched to English colorbox starts working immediately.
I have used this module before (on other sites) with no problems at all.
I tried to switch between colorbox and cssbox, exact same behaviour.

I have this problem on two websites. One is a clean install. The other has a lot of modules enabled.

Any idea how to get this working?


texts: Sort order for group in Organic Groups view "OG all user group content"

texts:
I am using Drupal 7 & Organic Groups 7.x-2.7.
I am using one of the "Views" that comes with Organic Groups called
OG all user group content,
which shows the content from all the group the current user belongs to.

I am trying to control how the Groups show up and can't seem to get it to sort.

Here is how the groups automatically show up

I would like the Amigo group to show up before the Authenticated group.
I've tried a couple things, such as
sorting by "OG membership: Entity id"
and sorting by "OG membership: Og membership ID"
but nothing seems to change the order that the groups are displayed in.

Anyone know how to do this?

Here is an image of the admin UI for the view:


texts:
sorry if this has been answered already, but my searches brought me to nowhere.

I have just installed LAMP environment on Amazon EC2 instance. It runs on:

Ubuntu precise 12.04 amd64 server
PHP Version 5.3.10-1ubuntu3.4
MySQL 5.5.28
Apache/2.2.22 (Ubuntu)
Drupal 7-18

Drupal installation tells me that I have not GD enabled and PDO extension are disabled. However, looking at phpinfo() I have :

GD Support  enabled
GD Version  2.0
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.8
T1Lib Support   enabled
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version unknown
PNG Support enabled
libPNG Version  1.2.46
WBMP Support    enabled

Directive   Local Value Master Value
gd.jpeg_ignore_warning  0   0

and

PDO

PDO support enabled
PDO drivers mysql

pdo_mysql

PDO Driver for MySQL    enabled
Client API version  5.5.28

Directive   Local Value Master Value
pdo_mysql.default_socket    /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock

So, in theory everything must work, why does Drupal not recognize them? I haven't changed anything at all from the clean install of LAMP. May I be missing something then?

Thanks in advance,
maxim


texts: How to display the description of the article with 150 characters?

texts:
My site is with Drupal 8, I have a content type "Article" with a body field.

I copied the twig node.html.twig file into my theme.

If I put the following code, the description is displayed:

{{ content.field_article_description }}

The parameter of the display of the field, allows to choose the number of characters. But he stops at the first sentence, cuts the word and does not display the elipse (...).

I want the description to be cut to 150 characters right after the word (I do not want the last nmot to be cut) and I want to add at the end an elipse (...).

I want the field to be displayed in plain text (without html tags).

Is it possible to add parameters to the description field with twig ?

Can you help me ?


texts: Is there a way to see where a file is used, with FID? I see the entry in the file_managed-table (Drupal 7), but not where it is used.


texts: Limit the number of nodes created from anonymous users

texts:
I am in the process of finishing the development of a small appointment scheduling system, just using node creation as an appointment. Anonymous users can thus make appointments via a node creation form.
In order to slightly limit the ease of spamming from a malicious person, I would have liked to know if it was possible to limit the number of nodes created by an anonymous user. I am well aware that it is not very effective security, but the objective is simply to limit the damage.
I found an extremely close answer to my question on Limit amount of content creation per anonymous user.
/**
 * Implements hook_node_access
 */
function MY_MODULE_node_access($node, $op, $account) {

    // Get node type, can be string or node object
    $type = is_string($node) ? $node : $node->type;
    if ($type == 'type_of_interest') {
      // Check flood limit for anon users node creation
      if ($op == 'create' && user_is_anonymous()) {
        // Ensure checked only once per page request, node/add path only
        $access_checked = &drupal_static(__FUNCTION__);
        if(empty($access_checked) && arg(0) == 'node' && arg(1) == 'add') {
          // Record the access check for drupal_static
          $access_checked = TRUE;
          // Check create_node limit of 2 per 12 hours
          // Note, you could make the threshold and window config variables.
          if(!flood_is_allowed('create_node', 2, 43200)){
            drupal_set_message(t('There is a node creation limit of 2 nodes per 12 hours. Please try again later.'), 'error');
            return NODE_ACCESS_DENY;
          }else{
            // Register the node create event to test against for 48 hours
            // Note, you could move this somewhere else to ensure the node is actually saved, e.g hook_node_insert
            flood_register_event('create_node', 172800);
          }
        }
      }
    }

  return NODE_ACCESS_IGNORE;

}

Unfortunately, this is a code block for Drupal 7.
Would the code be similar for Drupal 8?
I am not very used to programming with Drupal 8.


texts: How to template a view and be able to manipulate the content with it?

texts:
I'm wondering if there's a way to template a View, and actually be able to manipulate the content within it. I know I can theme the 'wrapper' around the View, but I'd like to be able to override what's inside the View, so I can create my own loops et cetera.

Right now I'm just having to create a view, and then make a template for the block (block--views-block--view-name.html.twig for example). This doesn't give me any access to the fields within the view though. I just have to wrap my markup around a {{ content }} tag, and adjust the formatting settings of that view.

I believe this functionality was available in D7, can I do it in D8?

EDIT:
Another example I just thought of is if I had a content type for locations of offices, I then made a view to display a list of these locations to show on a page. I want to be able to have access to data stores inside each location. This way I can then create loops etc on my contact page, looking through each location, displaying it how I'd like.


texts: How to add custom class in custom module?

texts:
I am not able to add custom class in custom module, I need to add class "ajax-link" in the anchor link to make it ajax based page load  .

function hook_node_view(array &$build, \Drupal\node\Entity\Node
$node, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display,
 $view_mode) {

 if ($display->getComponent('prevnext_next')) {
$build['prevnext_next'] = [
  '#theme' => 'prevnext',
  '#direction' => 'next',
  '#text' => t('Next'),
  '#nid' => $previous_next['next'],
  '#attributes' => array(
  'class' => array(
  'ajax-link'
      ),
    ),
  '#url' => Url::fromUserInput('/node/' . $previous_next['next']."?an=left")->toString(),
  '#void' => empty($previous_next['next']),
];
 }
   }

What am I doing wrong in the code ?

I want to create link something like this:

Next


texts: How to use drupal_add_tabledrag() with paging feature?

texts:
I have set up a table to reorganize content based on custom weight field. Everything works well without pager.

But if I add a pager to the form, only the items displayed will be reorganized - causing conflicts with items in other pages. Why drupal_add_tabledrag doesn't consider only the weight values that are in the current page. This would avoid any item in current page to take the same value as an item in another page.

The Taxonomy Core module do it perfectly. For example in the form where you can reorganize terms, there is a pager (admin/structure/taxonomy/[vocabulary]):

In Taxonomy form, when there are several pages, the last item of a page will appear in in first in next page (so user can drag & drop either against next items or/and previous items)

How can I do the same in a custom form?

/**** EDIT ****/

Due to @Aneek Mukhopadhyay answer, I updated my post.

Actually the issue is not related with pager, but drupal_add_tabledrag(). The pager is working well.

The drag & drop feature too. The problem is that when reorganizing content in a page, some items will take a weight value already used by another item (in another page).

For example here is the first page of my form (before dragging any item):

And the second page:

If I move the item "Test 11" for example, new weight value for the item "Test 2" will be 2:

And the weight value 2 is already used by item Test 1 (in second page)

To achieve that I used drupal_add_tabledrag() this way:

drupal_add_tabledrag($table_id, 'order', 'sibling', 'example-item-weight');

I tried several options with drupal_add_tabledrag() but didn't find any other way to make it working without issues.

I also checked the taxonomy module but cannot figure out how they work with drupal_add_tabledrag().


texts: I have a field that's a term reference field. If it has a value 'x' I want it to show on the node page. However if it has the value 'y' I don't want it to show. Is this possible?


texts:
I am trying to pull out a image field that is attached to a taxonomy term. I have tried using field_view_field with no luck. Does anyone have a good working example?

Thanks!


texts: How to get the field collection field value in twig file?

texts:
I have field collection field. I need the field value in field in twig file.
How to print the field value.
Image of the below code.
{% for item in items %}
    {{ kint(item.content) }}
{% endfor %}

Need the "field_project_from" date field value.


texts: How do I display a block on the checkout page based on the product type?

texts: I have created some custom blocks in code that are shown on the Drupal Commerce checkout page. I would like the block to have differ content basing on which items are in the cart. How can I achieve this in code?


texts: How to change user eMail field markup from preprocess function

texts:
I want to change the markup of the user's email field before it is getting printed.
Since there is a lot of logic I need to include, I want to change it from a preprocess function rather than twig.
Which preprocess function should I use and how would I change the field value?


texts:
I am trying to print out a few links on a custom page template. I would like to use the title and url from each route.

I am trying to print out the title from the route.

I know I can get the url from:

$url = Url::fromRoute('route.name');

and I know I can get the current page title from

$request = \Drupal::request();
  if ($route = $request->attributes->get(\Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_OBJECT)) {
    $title = \Drupal::service('title_resolver')->getTitle($request, $route); }

but I am not sure how to request the title from a specific/ different route.

Thanks in advance.


texts: Set expiry time for fields on content type

texts: Is there a module which allows to set expiry date on fields on content type. Needed when we want a particular field to be expired after a given interval of time, not the complete node as in case of node expire module.


texts: How do I theme user reset password page?

texts:
How I can template the user reset password page when I receive the reset password token based link?

/user/reset/2289/1545342420/zrmQkJAN9whwgu2xbKCW0KbIKigx7AsUgSo88UKr1c4


texts: Can we give serial numbers in views to each columns or row in a sequential manner?

texts:
Can we give serial numbers in a views to each columns or row in a sequential manner from left to right(like:1,2,3----so-on) without any manual work in backend .

I am using views format "content" not "field" in views,so there is no option to add field view result counter in views,i am using view mode in views display.


texts:
I have a one page template. So, my site is slowly... I use node_load function for all content and want, first css/javascript load, after content load... Is it possible?

Any module or other solution?


texts:
I'm using Drupal 6 and I'm pretty sure I'm using Views 3. I created a page called All Events (alias: all-events) and created a view that displays as a page. Under Page Settings for the path option I put all-events.

My problem is that I can see the view results in the preview, but whenever I go to the all-events page it is blank save for the title and the one tag I put on there.


texts: Create a button with an icon in render array, that can be themed by arbitrary contributed themes

texts:
Drupal 8 does not use HTML button tag for creating buttons, it instead uses the input tag to create buttons. This works fine for most part, except for buttons which include an icon gets messed up by themes which replace the icons with a gradient. For example, Bootstrap theme will replace the button icon with gradient, that makes the button empty.
Is there a way to create a button via render array that will generate <button ...><img ...  style button?
Alternatively, is there a way for a module to only use a twig template in special case, but  not all the time.
Other ideas?
Update: May 7 2020.

I have filed a Drupal Core issue to support new render type for imagebutton, hopefully it will get some attention, as this can't really be solved in contrib space.


texts:
What modules are available (profile2 would come in handy i guess) to create something like pages on facebook.
Like on facebook each containing description, galleries and some other content i make available.
All handled by user who created pages.

I have idea in theory how would each user create pages, but i have no idea how would he for example when uploading gallery tell Drupal that the gallery he just uploaded belongs to page 3, while this user has 10 pages.


texts: I use Drupal 8 and I need to create a view with few content types. When I navigate to a specific path, I need to list all of them at the same time, but I need something like a filter so that in this view only particular content type is displayed. How can I do it?


texts: Feeds: error when importing hierarchical taxonomies

texts:
While i am trying to import taxonomies with this structure:
name,guid,parent_name,parent_guid
Primary Energy,32001,,
Transformation,32002,,
Final Energy,32003,,
Electricity,32004,Transformation,32002
Generation efficiency,32005,Electricity,32004
Installed capacity,32006,Electricity,32004
Heat,32007,Transformation,32002

I am getting this error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1018-0' for key 'PRIMARY'
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1019-0' for key 'PRIMARY'
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1020-0' for key 'PRIMARY'
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1022-1021' for key 'PRIMARY'
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1023-1021' for key 'PRIMARY'

is there any thing wrong with structure of the CSV file & values inside it ?


texts: How to use kpr() or dsm() when i am not logged in

texts: I need to access my login form array using kpr() and dsm() functions but it's not working when I logged out from the site. How to debug and access the login form array as logged out.


texts:
I am having trouble setting up an RSS feed page view. I created the page, and attached the proper path; when I go to the page I am prompted to download an XML file. Shouldn't I get a page that only shows the content for the feed? What am I missing here?

I am using Firefox.
I clicked a system generated RSS feed from a node, and got the feed page as I expected, so the output is not consistent.


texts: Use a different template file if use is on a mobile device

texts: I currently am using page-front.tpl.php to display my Blog content type in a View. I want to use a different template if the user is on a mobile device, and have them either redirected to the mobile view, or have the Drupal theme layer use a different template.


texts: Scheduler changes node language on publish

texts:
The scheduler changes the node's language to default-language while publishing.

This happens if the scheduler is run by drupal's cron (called by system-cron or manually) and scheduler's lightweight cron (called by system-cron), but if i start the scheduler's lightweight cron manually by admin-interface it's published with the correct language settings...

It happens on both, single nodes and on translated nodes.

I tried for hours with different settings and configurations. The problem occurs on 2 big sites (with 3 languages), but not on 1 low-level site (with 2 languages).

Any idea?


texts: Having required (*) show up on the component itself and not the label

texts:
I'm creating a webform select options component and I want to hide the label.

Because this is a required, it needs to display with the red asterisk that the field is required.

However, the asterisk is displayed against the label header and when you hide the label, it doesn't get displayed in the option itself.

Is there any way around this?


texts:
I've found plenty of posts about changing the visibility of a block programatically.

My problem is the opposite. Given a block's ID/delta, how do I find out if it should be displayed at the current path?

I have a field collection that allows you to append a block using the Block Reference module (I preprocess the field collection and use my own template, so the logic has been taken away from the Block Reference module). It works, but I only want it to kick in if the "Show block on specific pages" rule says that block should be displayed.


texts:
How can I expose a table with out primary key in Drupal view 3
I have table st as uid, gid, percentage.

attendance_views_data() {

$data['attendance_percentage']['table']['group'] = t('Attendance');

    $data['attendance_percentage']['percentage'] = array(
        'title' => t('Attendance percentage field'),
    'group' => t('Attendance'),
        'help' => t('Attendance percentage field.'),
        'field' => array(
            'handler' => 'views_handler_field_numeric',
            'click sortable' => TRUE,
            ),
        'filter' => array(
            'handler' => 'views_handler_filter_numeric',
            ),
        'sort' => array(
            'handler' => 'views_handler_sort',
            ),
    );
}

The above code does not work as I can not see percentage field in my view feild.


texts: form or content type creation interface?

texts:
I want users to insert information. I can define a complex Content type with multiple fields, restricting the kind of info user is allowed to insert (integer, text…), as well as rules… and expose it as if it were a form when user clicks on 'add new info'.

But I want more complex things to happen, for example, when user submits data.

I am confused about how to achieve that (hooks in a module?).

Moreover, I have seen many tutorials around about creating forms (which imply a lot of coding for things like defining the data types, validation...that can be easily defined in Content type creation UI). Which difference would be between 'hacking' the 'add new content type' operation and creating a brand new form?

Sorry, as you may notice I am a brand new beginner in Drupal.


texts: Overriding Panels' default category structure

texts:
The development house I work at uses Panels for stuff a lot, and they're a central design tool for our clients. While we're able to group our own Panels content types and View Panes by specifying a category name, it isn't so easy for everything else: there's the useless content types in the "Activity" category, the confusing content types in "Entity", the overwhelming and mostly-useless content types in "Node (Tokens)", the really useless content types in "Page elements" (Why would I need to repeat design elements already in place on the page?)... I could go on.

Plus random blocks are always dropped in the "Miscellaneous" category -- seemingly the last place I always look for content types I cannot find.

What I really need is the ability to organize Panels content types, and hide categories that aren't needed.

To that end I've started work on a module that lets the use build and organize Panels content types into custom categories. However, the first major roadblock I've run into is convincing Panels to use my layout instead of the one it generates from the plugin info hooks.

In panels/includes/add-content.inc is template_preprocess_panels_add_content_modal(), which is where Panels seems to set up its category tree (Via the function's $vars argument).

Is there any way of inserting a hook into the function chain that
discards the $var variable that Panels is passing to
template_preprocess_panels_add_content_modal() and instead
delivers my own?
If not, is there a way to override template_preprocess_panels_add_content_modal() with my own
version?
Or, best yet, is there a module somewhere that already does what I'm trying to do?

Many thanks!


texts: Is there a way to alter only the printable invoice for Ubercart 3.8?

texts: Client would like to print order invoices from 'View Orders' page without their large logo at the top wasting ink. I do not seem to be able to isolate just the printed invoice without affecting the admin and customer invoice.


texts: How to override aggregator_block_view() in the aggregator module?

texts:
Can anyone tell me how to override aggregator_block_view in the aggregator module?

I have a feed I need to alter the html for and at the moment aggregator just turns the output into an unordered list.

I tried altering it in hook_item_list() but there was nothing for me to lock onto to identify the list as coming from the aggregator module.


texts:
I did a fresh install of Drupal 8.
Everything had a nice style while installing, but when it was done, there was no CSS anymore.
Did the installation change some file rights?

I tried flushing the cache
I did check if the core/theme folder has CSS files in it
I did a re-install, but again there is just raw HTML

I checked and it looks like I have an HTTP/1.1 500 Internal Server Error on all CSS and JavaScript files.

Update:
The issue is with the .htaccess file in /sites/default/files/.htaccess
I changed the permission of the file to 644, then once changed,
i did edit the file via the file manager and commented out these lines:

#Options -Indexes -ExecCGI -Includes -MultiViews php_flag engine off

It works now but is tis a safe way to do it?


texts: How to filter views "node-changed-day is not node-created-day"

texts: I want to list node posts so, that only those ones will display which node-updated day is not the same as node-creaded day but at least next day or newer. How to filter it in Views? I'm using Drupal 6.


texts: Does anyone knows how to programmatically download a library from https://cdnjs.com using Libraries CDN ?


texts: Why are hook_form_alter updates being reverted?

texts:
After I clear all caches I can see my update is effective in the Create Article form. Great.

But as soon as I refresh the page, or come to it afresh to create another Article, the unmodified value of #file_upload_title re-appears.

This is what I added to template.php:

function seven_form_article_node_form_alter(&$form, &$form_state, $form_id) {
    $form['field_photo_gallery']['und']['#file_upload_title'] = 'Add a new file or multiiple files';
}


texts: Changing library path with hook_library_info_alter

texts:
I am having difficulties to change the library path defined by another module in *.libraries.yml via hook_library_info_alter

Essentially I have one module defining a library component in its *.libraries.yml like that:

# Font Awesome
fontawesome:
  version: 4.7.0
  css:
    component:
      /libraries/fontawesome/css/font-awesome.min.css: {minified: true }

How has my hook to look like to change to path to:

  /libraries/fontawesome/web-fonts-with-css/font-awesome.min.css

Thanks for helping me!


texts: Override specific configuration keys in settings.local.php

texts:
I'm trying to learn the Drupal 8 configuration override system based on the documentation here:
https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-override-system
As a simple test, I have disabled the Shield module and exported config. Here's a diff:
diff --git a/config/sync/shield.settings.yml b/config/sync/shield.settings.yml
index 3f7482f18..d9f019ca4 100644
--- a/config/sync/shield.settings.yml
+++ b/config/sync/shield.settings.yml
@@ -1,4 +1,4 @@
-shield_enable: true
+shield_enable: false
 credential_provider: shield
 credentials:
   shield:

Now, in my settings.local.php I have attempted to override this config key:
/**
 * Disable Shield (HTTP Basic Authentication).
 */
$config['shield']['shield_enable'] = FALSE;

This approach does not seem to work.
Do I need to do anything else to override the configuration?
NOTE: This is a contrived example. I could use configuration splits to disable HTTP basic auth in the production environment, even if it's enabled in the active database configuration. In fact, I am hoping this approach will allow me to use environment variables to provide environment-specific values for authentication tokens, API keys and other secrets that may change in sandbox and production environments, but details are irrelevant to the question.


texts: Optional extra products on add to cart form

texts:
We're trying to have it so that on a product display there are optional extras which can be added all at the same time as the main product by selecting checkboxes. These products are optional extras which are product specific.

We have tried the Commerce Product Add On module but it breaks with an ajax error when there is more than one main product variation and another option is selected on the product display front end.

We are trying to debug the error but we are also wondering if this can be created using something which already exists such as views bulk operations and rules. Any help would be much appreciated!


texts: In my site I am using blogs module. When I used sitename/blog default blog page will display. But my requirement is, I have created a view to display the blogs, this is on the path of sitename/blog-display. I want to display this view when i type the url sitename/blog. please suggest me how can I solve this. Thanks in advance for any suggestions.


texts: Unable to access Admin page after core update (minor version 7.? to 7.77)

texts:
After manually updating Drupal 7 core - I am unable to access the /admin or /user page.
Here's my process:

backed up db
entered maintenance mode
manually downloaded Drupal 7.77 (deleted default 'sites' folder)
changed root directory name (httpdocs_old); created new root directory (httpdocs); copied new core files into httpdocs (copied 'sites' folder and .htaccess from old to new) (*note on this process below)
ran update.php, no errors
now can't access admin - 403 Forbidden "You don't have permission to access / on this server."

*Possible cause: while copying new core files to root directory, I inadvertantly dropped the core files into httpsdocs instead of httpdocs. Once i realized what I did, I moved the core files back over to httpdocs.  If those two directories (httpdocs and httpsdocs) have any identically named files, then I likely overwrote the httpsdocs files when I accidentally pasted the core files there (or moved them out when trying to correct the mistake).
If that's the case, if httpsdocs contains files that affect /admin or /user access, how would I go about recovering that?  How can I find out what files are supposed to be in httpsdocs?
If that's not the case, how might I troubleshoot/resolve the 403 error?
Thank you in advance for any help you can offer this knows-enough-to-get-in-trouble type. I'm no pro, however I have successfully applied several drupal core updates in the past.


texts:
For a car selling website, there is need that the user choose his car and depending on his choice, another list should appear with the available models.

I search to do this on a conditional system, but also a list with hidden submenus would be acceptable.


texts:
theme_menu_link allegedly "Returns HTML for a menu link and submenu."

In attempting to use this 'hook' I added code to my template.php as such:

function themename_menu_link(array $vars) {
  dpm($vars);
}

It didn't work.  Nothing appears.

I confirmed that the template.php code is executing and cleared caches several times.

Every other hook_ or theme_ function I've tested runs without issue, however this one does not.

I've also tested the alternative method, themename_menu_link__your_menu_name with no success.  The code seems to be ignored.


texts:
I received a somewhat complicated Drupal 6 application to maintain and unfortunately I am quite a newbie with Drupal.

The task is to verify certain system variable is set before saving the node. Is the node_presave ok place to do this? And how can I abort the saving process?

It should fail silently with a log message.


texts:
I would like to create a View which shows the Organic Group hierarchy in a side bar, see below for hierarchy. Also upon selecting content title from this sidebar, then shows the node content in the main page section, with or without a page reload.

I create a view with the 4 content types, but I cannot work out how to sort them by their hierarchy?
Also how do I then setup the view to show the Slide content in the main page section upon selection?

Content and Group Types:

Class: Group
Course: Group
Lesson: Group
Slide: Group Content

Organic Group hierarchy:

Class
 - Course
 - Course
 - Course
 - Course
 - - Lesson
 - - Lesson
 - - - Slide
 - - - Slide
 - - - Slide
 - Course
 - Course


texts: Contextual Links Call to undefined function user_access

texts:
I am trying to import my drupal site into Acquia Dev Desktop and keep getting this error:

  Fatal error: Call to undefined function user_access() in /Users/brendan/Sites/homedir/public_html/hewinsfinancial/modules/contextual/contextual.module on line 86

function contextual_preprocess(&$variables, $hook) {
  // Nothing to do here if the user is not permitted to access contextual links.
  if (!user_access('access contextual links')) {
    return;
  }

  $hooks = theme_get_registry(FALSE);

  // Determine the primary theme function argument.
  if (!empty($hooks[$hook]['variables'])) {
    $keys = array_keys($hooks[$hook]['variables']);
    $key = $keys[0];
  }
  elseif (!empty($hooks[$hook]['render element'])) {
    $key = $hooks[$hook]['render element'];
  }
  if (!empty($key) && isset($variables[$key])) {
    $element = $variables[$key];
  }

  if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) {
    // Initialize the template variable as a renderable array.
    $variables['title_suffix']['contextual_links'] = array(
      '#type' => 'contextual_links',
      '#contextual_links' => $element['#contextual_links'],
      '#element' => $element,
    );
    // Mark this element as potentially having contextual links attached to it.
    $variables['classes_array'][] = 'contextual-links-region';
  }
}


texts: Custom VBO action to print selected nodes

texts: I would like to use views bulk operations to select and then print a large amount of nodes at once. I only want the print dialog box to open one time for the whole batch. Any ideas on how to approach this process?


texts: How can I generate a Report from database table? and how can I show it in page

texts: I want to generate a report from values of a database table. I tried table wizard and views to generate reports. It shows it. But how I show this to a perticular Page/form.


texts: Flexslider with Link - using Flexslider Field Collection

texts:
I am using Flexslider with Flexslider Field Collection.

This is working.

But now I need to include Links for each slide. And only found help when using Views.

Is there a way to include links to each slide without Views?


texts: I would like to make some changes to the core toolbar module across all my sites, and I don't want to modify the actual core's css.  It looks like I should be able to override the core css found in modules/toolbar/toolbar.css by simply copying this file into my sites directory at /sites/modules/toolbar/toolbar.css.  I tried doing this, cleared the Drupal cache, but nothing happened.  What am I missing?


texts:
I  have found that when I replace forms with AJAX, then the new forms loose their display styling. It seems like the css for the forms are not working any more.

How to solve this issue?
Do i have to write js bind with .on() function to add css again? Any other suggesions?


texts: How to send uploaded file as a link in entityform submission

texts:
I am using entityform for getting the user details. The entityform also contains a file field where user uploads resume. After the submission user gets the submitted form via email.

How to send the link of the uploaded file in an email to user.

Thank you.


texts: EntityWrapper error in in drupal commerce

texts:
I"m getting following error on checkout page after applying userpoints_discount in drupal commerce.

Error:
having error at EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 335 \sites\all\modules\entity\includes\entity.wrapper.inc

Can you please help me in this issue.
Thanks in advance.

-Naveed


texts:
I have just implemented a css sprite for a list of items. The purpose of this was that when a user hovers over an item, the image changes... What I have been asked to do now is  to add a pop up for each of those list items. How would I go about doing this?

Is there any way by using aFancybox module to achieve this?

The pop up would consist of a page title, image and a close button.

At the moment the list items are hard coded in the page.tpl.php template.

I use drupal 7

This is the sort of thing I am trying to achieve. So a set of images which change on hover, and when clicked on a little pop up appears.


texts: How do I put the copyright / name site in footer

texts:
In the four themes I tried before choosing the one I have now, the name of my website was always featured with the copyright in the footer of my webpages, but now all it says is "Copyright © 2013, ."

Is there an easy way for me to adjust the code so it does credit the site after that comma and before the period? I'm not very familiar with code so I'd be ever so grateful for an easy way. I tried searching for the copyright sign and the year in a few pages but they didn't show up so I suspect there are other ways to describe those in code, right? :)


texts: How to add "publish content" to a node view tab

texts:
I'm developping a website where I'm asked to add a tab "Publish content" next to the Edit tab. I was told to use the hook_menu, but so far i didn't succeed in showing the tab.

Here is what I have done so far :

function mij_bo_add_menu(){
    global $items;
    $items['node/%node/edit'] = array(
        'title' => t('Publish'),
        'page callback' => 'node_page_view',
        'page arguments' => $items['#primary'][1]['#link']['page_arguments'],
        'access callback' => 'node_access',
        'access arguments' => array(1),
        'weight' => 5,
        'type' => MENU_LOCAL_TASK,
    );
 }

Any suggestions?

PS : I am still a novice in Drupal programming.


texts:
I have a custom database table with a datetime column that I have made accessible to Views. I want to create a line charts of number of rows per day but I can't get the View right.

With aggregation on I have a COUNT on my ID field and I'm trying to group on my date field by day (it currently has year -month - day - hour - minute - second). I have set the date format to d/m/Y and aggregation to group results together but they are still separate.

Obviously this makes for a pretty bad line chart

What I really want is

18/01/2017    23
19/01/2017    25
20/01/2017    19

I tried the Views Date Format SQL Field module (dev version too) but it doesn't seem to work as I don't get an option to format my date as SQL.

Is this possible in Views?


texts:
I'm trying to add a front page image as part of the theme setting. And so far I'm able to upload the image; however, I need to be able to get this in preprocess function so I can use the in my templates.

Here is what I got so far

casper.theme

/**
 * Implements hook_preprocess_page().
 */
function casper_preprocess_page(&$variables){
    $variables['frontpage_background_image'] = theme_get_setting('frontpage_background_image', 'casper');
    kint($variables['frontpage_background_image']);
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function casper_form_system_theme_settings_alter(&$form, &$form_state, &$theme) {
    _casper_theme_settings($form, $form_state, $theme);
}

 function _casper_theme_settings(&$form, &$form_state){
       $form['theme_extra']['frontpage_background_image'] = array(
        '#type' => 'managed_file',
        '#title' => 'Front Page Background Image',
        '#description' => 'Add background image for the front page',
        '#required' => FALSE,
        '#upload_location' => file_default_scheme() . '://theme/backgrounds/',
        '#default_value' => theme_get_setting('frontpage_background_image' , 'casper'),
        '#upload_validators' => array(
            'file_validate_extensions' => array('gif png jpg jpeg'),
        ),
    );
}

And here is the kint results

So my question is what I'm doing wrong ? What should I do to get the URL instead of a number ?


texts: file_unmanaged_copy - Any service alternatives?

texts:
The functionality of the file_unmanaged_copy is exactly what I need. The only problem is: it's a global function which uses static service calls.
Since I need to unit test my class (and not to mention how I dislike hidden dependencies coming from global functions) I can't use it.

Am working with D8 since the very beginning, but am failed to find any OO alternatives. Has anyone faced the same situation? Any "Best-practises" or workarounds?


texts: Custom template file for taxonomy term in drupal 7

texts:
I need to create only one tpl.php file for all taxonomy terms in my website. I know taxonomy_term_page.tpl.php will do the required function in Drupal6.

For drupal 7 I had override the taxonomy-term.tpl.php. I see all the nodes associated to a term, is displayed at the last.

How can I hide those nodes?


texts: How to programatically add attachments to a user (securely)

texts:
To any Drupal 7 gurus out there... I have hundreds of PDFs that need to be uploaded to users as their own private attachment. I've created the PDFs in the folder:-

../website-files/userfiles-{uid}/filename.pdf  (There's one for each uid)

My field_data_field_attachments table has the "field_attachments_fid" column with the id relating to the file_managed table.

This is all pretty self explanatory, until... I find the file_managed table has two mysterious columns:-

  __pk
   __unique_uri

Both seem to be MD5 checksums, e.g:-

  4A448458-860C-4E16-B901-F8841136C17D

So my question is; how do I correctly generate these two values for each attachment I import to the DB?

Thanks,
Darren


texts: Retrieve field value using PHP + Search API + Views?

texts:
I haven't had this problem in the past but I'm trying to retrieve a field value in a Views PHP Field for a view I made for Search API. I'm using the code below but I tried with 'nid' as well.

$stream = $data->_field_data['vid']['entity']->field_stream['und'][0]['value'];

You can see the var output here. I'm trying to get field_stream but am having no luck...

http://www.ovwrc.com/waste-search?search_api_views_fulltext=poop%20poop


texts: How can I call custom javascript on successful webform submissions through hook_form_alter?

texts:
I have some custom js code which should be executed after successful webform's submission.

JS Code :

jQuery('document').ready(function(){
    form_submit_telium();
});

below approaches, I already tried

1.

$commands = array();
$commands[] = ajax_command_invoke(NULL, 'form_submit_telium');
$page = array('#type' => 'ajax', '#commands' => $commands);
ajax_deliver($page);

-> It's not working, due to my webform is not submitted through ajax call.

$form['#attached']['js'] = array(
                drupal_get_path('module', 'module_name') . '/js/form_submit.js',
            );

3.

drupal_add_js("jQuery('document').ready(function(){
      form_submit_telium(); });",'inline');

Webform alter code:

function module_form_alter(&$form, &$form_state, $form_id){
    $form['#submit'][] = 'telium_form_submit';
}

function telium_form_submit(&$form, &$form_state){
    // above three approaches
}

Please let me know if you have any other approach to do the same thing.


texts: Translated Taxonomy terms in node creation page?

texts:
Drupal 7 multilingual website(English and Arabic):

I have a taxonomy term named "Food Category".Added some terms in it.Also i added translation for each terms .

I added a field to select the term in a content type :

LABEL : Select List Food Category Item

MACHINE NAME : field_list_items

FIELD TYPE : Term reference

WIDGET : Select list

I want to show the Arabic terms when i translate a node to Arabic.Now it is in English only.

Please advice me.


texts: Search API isn't returning results with words in the title

texts: I just installed search api and setup a server and index. Then I setup a Views page and exposed the search filter option. Searching all fields work, but for some reason its not searching the title. What could be the issue? I tried turning all fields off on the index and just left the title field option and its still not working.


texts: Is it possible to fire a condition with JavaScript?

texts:
I have a webform with radio buttons, where I have conditionals made normally with webform conditions tab setting. Everything works nicely, I have some fields (just text fields) depending on conditional logic based on the previously mentioned radio buttons.
Now I also have some CTA buttons on the very same page that just scrolls to a webform where they should pre-select a radio button, which I can easily do with JavaScript, but the conditional logic is not fired at all.
Basically, it works when I click manually, but once I try to trigger the click, the conditional logic is not being fired at all.
How can I achieve this?
I really like how easy it can be setup in webform and I don't want to go with JavaScript hide/show way of "conditional logic" in my code.


texts: how to export custom installed module(s) configurations?

texts:
Possible Duplicate:
  Deployment for staging and production

how can i export the change in configuration of a custom install module, configuration module is exporting configurations of these, components Content type,Field,Image style,Variable,Permission, Vocabulary.


texts: How to modify the query that the views integration with the chart API module provides?

texts:
I am using Google Charts API module to generate a pie chart of a content type with the fields Blood-group and count representing the sectors.

For this I need to completely alter the query (= select from a different table) that the views integration provides.

My question: Can I use hook_views_query_alter?


texts: Add easing jquery effect to views transition on mouseover

texts:
I am working on a fitness site for my friend.

I created a recipes content type, and created a view for the front page that would show the cover image for the 4 newest recipes.

Currently in views I have three fields selected to show, the recipe title, the cover image (these two I have set to not display), and then a global text which reads like below.

[field_recipe_image]
[field_recipe_title]

I have it set so that on hover the recipe image disappears and the title shows up instead, and I am doing this with some simple css.

What I would like to find a way to do is to inject some JQuery into the transition between the image and the title. I really like http://jqueryui.com/effect/#easing example number 31.

My question is how do I put that JQuery effect in the view?  Is it something I would put in a global text area or is there something more complex to do?

Thanks for any help


texts: Redirecting doesn't work with a custom form in a block

texts:
I developed a custom form with FAPI and added a block for it.

Block is included only on one specific page (basic node).

When user submits this form it should redirect user to external site (URL is a return value from another external site).
For this purpose I've used $form['redirect'] which was working when this form was used as standalone page.
In block it won't redirect and instead the same page is loaded.

I tried other methods too for redirecting such as php header location and drupal_goto but none of them work.

Perhaps there is something node level overriding that prevents the form redirect?

EDIT:

Block is a very basic implementation on code level. API based hook_info and hook_view functions accompanied with custom content function (which returns form markup:drupal_get_form('my_form')).

The redirect is defined on hook_form_submit($form, &$form_state) in which it first makes two calls to external web services and based on return values it either redirects or shows message:

// Debug shows that this evaluates true
if (!filter_var($webservice1, FILTER_VALIDATE_URL) === false) {
    $form_state['redirect'] = $webservice1;
} else if ($webservice1 == 'ok' && $webservice2 == 'ok') {
    drupal_set_message(theme_item_list($formvalues),'status');
} else {
  drupal_set_message('Error', 'error');
}


texts:
Not sure if it's a dupe issue, couldn't find it. Just trying to run an upgrade in drush8 and get:

The drush command 'migrate-manifest' could not be found.  Run drush cache-clear drush to clear the commandfile cache if you have installed new extensions.

Tried with previous 8.* version and got the same problem.


texts:
I am trying to display the events on a calendar, and have setup the calendar module with the date/ time. I am able to get the events to display on the calendar but they all are showing up as all day events. I have adjusted the formatting of the date/ time every way I can think of.

Adam


texts:
I have tags (taxonomy terms) and created a tags pageview.
I want to sort my tags alphabetically and group them by letter of the alphabet.
How can I do this? Thank you
I want a single page. I don't want to filter the results.
A :
ring
accessory
B :
bracelet
cap
candle
...

UPDATE
I have found a possible solution but I need help. In my view I created a "Global: Custom text" field and I grouped this field in the format of the view.
It sounds really good. Now what TWIG code to put in the "Global: Custom text" field to extract the first letter of {{ name }} (which corresponds to the field "Taxonomy term: Name").
I tested the following code, but it doesn't work :
{{ '{{ name }}'|first }}


texts:
We build a Drupal 8 based content management system that uses a triple store as the main data back-end. So we don't have any content data in Database tables. All CRUD operations on entities stored there work fine.
BUT: Views integration seems to be much harder (or even impossible?). As views - and especially Drupal\views\EntityViewsData heavily relies on database tables it is not obvious how to provide the Views module with the required information without having to mirror everything in the local DB.
So, the question in short:
Will Views work without a DB? And - if yes - what classes will we have to implement to achieve that.


texts: Prevent embedded video appearing above image overlay

texts:
http://www.fareham.ac.uk/news/2011/10/17/skins-star-inspires-students

The above page includes an image gallery, powered by the Brilliant Gallery module.

The problem: when a thumbnail from the Gallery is clicked, the embedded YouTube video beneath the Gallery section appears above the image overlay (powered by the Lightbox2 module).

How can I prevent this from happening?


texts: Show Block when Listing one Content type

texts:
I have a silly question, i have one content type "ABC" and i have create a view page for listing all contents of that type with path "/abc". Next, i create a block which is listing all content of type "DEF", and configure the block "DEF" to show only when i'm listing the content "ABC", but not work.

Only work when i'm configure the block and put on "pages" restriction page like "/abc" path.

I'm doing something very wrong.

Any hint?


texts: How to fix "Hook implementations should not duplicate @param documentation."?

texts:
I am using PhpStorm to experiment with cleaning up my code in a custom module.  For the following function, I'm getting this warning:

  Hook implementations should not duplicate @param documentation.

/**
 * Implements hook_field_widget_form_alter().
 *
 * @param array $element
 * @param array $form_state
 * @param array $context
 */
function mymodule_field_widget_form_alter(&$element, $form_state, $context) {
  if ($context['widget'] instanceof \Drupal\text\Plugin\Field\FieldWidget\TextareaWidget) {
    $element['#after_build'][] = '_mymodule_remove_textarea_help';
  }
}

What should I do to fix this? I thought I needed to delete the @param comments, but when I do that, PhpStorm complains that I don't have any param comments.


texts: style.css doesn't refresh while Bootstrap sub-theming

texts:
I followed the Drupal Bootstrap sub-theming documentation: basically copied the CDN starterkit and renamed all the files and it seems to work.
I then added a line to the empty css/style.css.

At first it didn't work except when I went to /admin/appearance/settings/ and clicked the advanced tab and set the theme to 'Bootstrap (Default)'.

I then made more modifications to the style.css, this time it didn't refresh on the pages. Checking the rendered pages I found the css file is coming as a mangled named css file.

What is involved in generated this mangled file and how to refresh after modifying css/style.css?

Can I choose a different theme from the Bootstrap settings page and still use my css modified styles?


texts: Find the custom module responsible for a URL

texts:
On a site I did not originally develop, I'm stuck having to fix display issues on an arbitrary page.

Is there a way to locate the custom built module responsible or the source of a given URL path?


texts: Insert several lines in field collection programmatically

texts:
I have a problem with field collection and entity reference fields. I have a field collection called 'field_co_intervenant' and i want to add several entities in this field collection and after saved my node. But i got an error with the index i think, because when the node is saved, there is just one reference entity in my field collection. You can see the code here :

$intervenant is the array of my 'nid'.

if(!empty($intervenant)) {
    //Create entity
    $fieldcollection = entity_create('field_collection_item', array('field_name' => 'field__doc_fc_intervenant_tab'));
    //Attach entity
    $fieldcollection->setHostEntity('node', $node);
    //Fill field
    $i = 0;
    foreach ($intervenant as $val) {
        if($val != null) {
            $fieldcollection->field_fc_intervenant_tab[LANGUAGE_NONE][$i]['target_id'] = $val;
            $i++;
        }
    }

    //Save entity
    $fieldcollection->save();
}

How can i save all my values in the field collection and not just one ?

Thanks


texts: Private file upload using core's contact module

texts:
I am using the core contact form module for user applications. I have set a private file upload directory in settings.php. When the user submits the application form I require them to also upload a CV (.pdf and .docx file types).

The file upload doesn't work and there are no errors in watchdog. Should I use webform, and if I use will I not loose the entries I already have, without the file attached?


texts: Set xdebug.max_nesting_level to higher value

texts:
On my Drupal 8 installation, I am getting this Requirement Problem:

Xdebug settings
   xdebug.max_nesting_level is set to 100.
   Set xdebug.max_nesting_level=256 in your PHP configuration as some pages in your Drupal site will not work when this setting is too low.

On my server, I tried setting it under /opt/app-root/etc/php.ini.template but doesn't work.

Can this be done on the settings.php or .htaccess?


texts:
Sorry if this question has been answered already but I couldn't find an exact answer. Maybe I'm missing something.

Context of my issue:

I have a view that lists fields of certain content type. One of the fields is the nid. I need to do some validation in the view template before printing anything. So I need to call a function and check something using the nid as parameter. In my views-view-fields.tpl.php I do something like:

<?php foreach ($fields as $id => $field): ?>
    <?php if ($id == "nid"): ?>
        <?php my_function_here($field->content); ?>
    <?php endif; ?>
<?php endforeach; ?>

As you might expect, $field->content is a string and if I do something like this in my function, it just won't work.

function my_function_here($nid) {
    var_dump(node_load($nid));
}

I tried casting the value to integer, but still no luck (casting returns 0):

function my_function_here($nid) {
    $nid = (int)$nid;
    var_dump(node_load($nid));
}

and

function my_function_here($nid) {
    $nid = intval($nid);
    var_dump(node_load($nid));
}

So my question is: how do I get the nid in that view template?

Big thanks in advance!


texts:
I need to find the url path to the translated node of a page , the Multilink Module seems to do just this, is there something similar for Drupal 8? How do I find the path to the translation of a node in Drupal 8?

thanx for your help


texts: Using a backup file to transfer a site to new directory

texts:
I am working on a project on a sub-domain of my site that when it is ready I want to move it to my client's site. I was wondering if I can do this by creating a back-up file using 'Backup and Migrate' and installing Drupal on their site and loading this back-up file to move all my work there. Is this possible or is there a better way?

All the best!


texts: How can I increase the number of allowed values on an image field?

texts:
I need to increase the allowed number of image uploads to 15. Is there anyway to do this in a module or other means without hacking core files as suggested here - http://drupal.org/node/680546#comment-4126378?

This is Drupal 7.

Thanks,
Tim


texts: How can add a textfield to user/register page form in drupal 7?

texts:
I want modify and adding a textfield in my Drupal 7 user/register page. I know that the form is generated by the function user_register_form()

Can i add a textfield in this way?

function bartik_copy_user_login($form, &$form_state) {
  global $user;

  // If we are already logged on, go to the user page instead.
  if ($user->uid) {
    drupal_goto('user/' . $user->uid);
  }

  // Display login form:
  $form['name'] = array('#type' => 'textfield',
    '#title' => t('Username'),
    '#size' => 60,
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#required' => TRUE,
  );

  $form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal')));
  $form['pass'] = array('#type' => 'password',
    '#title' => t('Password'),
    '#description' => t('Enter that accompanies your username.'),
    '#required' => TRUE,
  );
$form['address'] = array('#type' => 'textfield',
    '#title' => t('Your address'),
    '#size' => 60,
    '#maxlength' => 125,
    '#required' => TRUE,
  );

  $form['#validate'] = user_login_default_validators();
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in'));

  return $form;
}


texts:
I have a content type that when created is "due" 10 days later. I'm looking to create a field that has a numerical value of the days left before it is due and if it is past due, show a negative integer value. This field will be used for Views sorting, so I can't use javascript counters like the countdown module.

Can anyone help on how to do this?


texts: How to track an action when user creates a node of a specific content type?

texts:
I use Drupal 7 and I want to track an action when user creates a node of a specific content type.

I installed the Facebook Pixel and Facebook Tracking Pixel modules, but they don't support my needs. Is there any way to implement this?


texts: Deploying content updates from staging server to live server

texts:
We are trying to deploy content updates from our staging server to our live server but are having difficulty finding a good way to do this. We need to be able to deploy new pages, page updates and occasinally page deletes. Our site also makes extensive use of the book module so the Deploy module doesn't work for us at this time. We are using features for large structure updates. So, our concern is just the daily content updates.

Are there any modules that can do this and handle book pages?


texts: How would files be uploaded to a 2nd domain?

texts:
So I have a Drupal site on my company intranet, and when uploading files, it all goes to the default/files folder as normal, however when uploading video files specifically, the base url is different from the Drupal base, it's a second domain specifically created for hosting assets.

I.E.

Drupal base / source of all uploads except videos

server.domain.com

Source of videos

assetserver.domain.com/sites/default/files/movie.mp4

I have no access to the server outside of the Drupal back end, and I cannot find the settings for specifying a domain anywhere (within File settings, Media settings, etc). As far as I know, there is no mention of this 2nd domain (assetserver) anywhere within the drupal codebase or backend. I'm just wondering if there's a setting outside of Drupal that can be used to set this, for example in the .htaccess file or something along those lines?

Any insight from someone who has worked with similar issues will be appreciated.


texts: Drupal Rooms Show Booking Unit Name in Confirmation Email

texts:
I have had a drupal rooms site running for a few months now, and the client has come back to me asking for the selected room to be shown in the confirmation email sent to the customer.

I have had a look through the available tokens that come with rooms, but there isn't one to display Bookable Unit Name, probably because it can be a multiple value field if more than one room is booked.

Or even a way to display the Rooms Unit name in the line items, then that would print in the notification email under the line items token?

I have gone to products > room products > manage display > line items, but there is nothing there to display the name.


texts: How to create custom commerce order states?

texts:
I want to create custom order state's and in a view use a "button" or a "select list" to toggle those states.

For example I have view that display's a table of all orders that are marked completed.
I would like to add a "button" or "select list" to each row so that I can toggle the state for each order.

Can this be done?


texts:
I'm new to react and Drupal. I run into the following 403 error in my reactjs login code.

I'm using a custom authentication method that I have working, at least using Postman. I also have it working from the Chrome developer console, if I manually copy in my session token by first visiting /session/token in another browser window (https://github.com/justinlevi/json_web_token).

What has me confused though is that this works fine if I get the anonymous token manually and plug it in to Postman or the Chrome debug console with the following code.

The custom authentication I'm trying to get up and running just takes a JSON object with username/password and returns a JWT token if authenticated.

justinlevi/json_web_token
json_web_token - drupal json web token based on https://dropsolid.com/en/blog/drupal-8-and-react-native post

If I run the following JavaScript code from Chrome developer tools.

1 - Request sessions token

fetch('http://blt.dev/session/token')
  .then(
    function(response) {
      if (response.status !== 200) {
        console.log('Looks like there was a problem. Status Code: ' +
          response.status);
        return;
      }

      // Examine the text in the response
      response.text().then(function(data) {
        console.log(data);
      });
    }
  )
  .catch(function(err) {
    console.log('Fetch Error :-S', err);
  });

I will get some session token, GVRpRLO_GkJbPRd00JEfvXP7ycSIP4UYR766zuGchRc.

If I then use this session token to try and login, with the following code:

2 - Use session token to try and login

fetch('http://blt.dev/api/v1/token?_format=hal_json', {
     method: 'POST',
     credentials: 'include',
     headers: {
       'Content-Type': 'application/hal+json',
       'X-CSRF-Token': 'GVRpRLO_GkJbPRd00JEfvXP7ycSIP4UYR766zuGchRc',
       'Authorization': 'json_auth'
     },
     body: JSON.stringify({ username: 'admin', password: 'admin' })
   })
   .then(function(response){
      if(!response.ok){
        throw Error(response.statusText);
      }
      return response;
   })
   .then(function(response){
      return response.json()
   })
   .then(response => {
     try {
      console.log(response.token)
       return response.token;
     } catch (e) {
       console.log(e);
     }
   })
   .catch(error => {
     console.log(error);
   });

I now get a 403 Forbidden Error.

Error: Forbidden
    at <anonymous>:13:15
    at <anonymous>

If instead, I first visit /session/token in my browser, copy/paste that token into the second JavaScript snippet above, I get the following expected result:

  eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MDcxMTk5MjYsImV4cCI6MTUwNzEyMzUyNiwiZHJ1cGFsIjp7InVpZCI6IjEifX0.MS9FvAIseMeD0rZr7-h_b74Sj7BoGi7rCd9wNDa0ypOlvFBNI5sWOs6NWUOlHe_sI7eQMkFfaovgoUIShf9-N3rnZKhQm8fKGxTzqi_s1dCxkIm62vf-2a6NaX0i0t-PtWaMkhd7BUdA4E__N9BzXexnHz3kroicjqQJ0hH17ub0sSOTtNjnWtMjjX35LH0vY17eLaCsOmXpYQzEiUDaAthVJaR3azwwQTc8ChVXbtLYgPWtbekObi-hsliZBdDmz41HnqgIrhjlrnrkWQzlxoOsB_UiD4Ht9oy4GJfzKKi5wbGZ6ayGv7XPoIuih1uJFgAquRmgFeHlbXhH2mhbyQ


texts: How to resize automatically when users upload images by CCK image field

texts:
I would like to make the size of images smaller automatically when users upload them using CCK image field.

For example, I would like to let users upload big sized images like 5MB but resize them smaller automatically like 0.5MB before saved on the server.

The reason is that the capacity I can use on the shared server is very limited. Of course I can set "Maximum upload size per file" to a small size but then users who have big sized images but don't know how to resize them before upload will not be able to upload them. I have tried also "image cache" a bit but it doesn't seem to save the files with the name, attributes and in the directory specified by CCK image field.

I don't know if this kind of thing is possible to achieve or not.. Any Idea?


texts: Changing product price depending on node field in commerce node checkout

texts:
i am using comerce_node_checkout with drupal_commerce

I want to change product price depending on node field .

eg,

I have a field as field_gender if we select male then price will be 1000.00 or if we select female then it will be 500.

Any help is most appriciable.

Thanks in advance .


texts: Actual output in view is different than preview

texts:
I have set up a view to display all nodes for 1 taxonomy term. Something got messed up and now the final view drops one node (which is also a different content type).

I cannot find rhyme or reason why the content type with images is being left out.

I have deleted the old view and copied a working one that has been set up for a different model again, changed taxonomy term, path and link and BANG the gallery node missing again.

The preview of the view shows it as it should be.

The page affected is this one:
http://www.riverlakesea.com/smartwave/skippa

A pointer where I must check would be much appropriated since I have been through node/content type/view gazillion times and cannot spot the problem.

Many thanks,
Susanne


texts:
Good Morning,

I'm using a custom template for an area where members are logged in.  I would like to have a specific template for all pages of the Member content type. I've been able to do this with a page template a la page--node--11.tpl but I don't seem to be able to change the node template to include all the details of the page template (a la the side bars)

Any suggestions for how I can do this with a content type template.  I have custom configs for the sidebars and footers for this content type so I'd like to be able to use a general template and not one for each node.


texts: What else apart do I need enabled, apart from "block to region" in Display Suite Extras for the "block regions" vertical tab to appear?

texts:
I've enabled "block to regions" in Display Suite Extras and I have enabled "Full Content" in "Manage Display".

But the "block regions" vertical tab still does not appear among the other tabs beneath the field table in "Manage Display".

Is there anything I should do to make the "block regions" appear?


texts:
I have one view and need to filter from more than one content type and condition. But I can only use only one group, if I create more group, the content can not be selected.

please kindly answer my question.

Thank


texts: How to combine different node in single views

texts:
I'm currently doing recruitment system by using drupal 7..

First..
In my system, applicant need to fill up the "Applicant Profile" (node) before they can apply for the job.

Second..
i am using flag module..if applicant want to apply the job, they must flag the job..after that, they need to fill up their "name" and make some "pitch" (Flagging form)..

Third..
In my views, i add "flag" at relationship so i can add the flagging form details in the fields.At filter criteria, i add the "content:type (Applicant Profile)"

My question..
how i want to combine the details in flagging form and applicant profile in single views?
because currently the views fields only can display the flagging form details..

i already add two different "content:type" at filter criteria. but it does't work..it only show the details on one content type only..
Thank You in advance..


texts:
In each user's profile there's a user reference field called "other editors." For all the users selected in that field, they should be allowed to edit that user's profile.

My first thought was that there'd be some kind of user access hook which would let me allow/deny users based on some criteria, but the only thing I can find is hook_node_access(), which doesn't get called when viewing a user profile. Is there a hook I'm missing, or do I need to look elsewhere?


texts:
I  have a Drupal 8 website with  Shorten   producing short links to content. "Tokens" and "Record Shorten" module are installated as well.

I've like then to build a view exposing a text like "Hey,  the shorten link for the current node is {{ current_node_shorten_link }}"

How can I achieve this?


texts: How can I update file attachment and keep filename?

texts: I understand changes of file attaching in D7, but problem is, if I delete and re-upload changed file, the deleted file is still on server and re-uploaded filename gets changed. If I understand correctly, removed file is deleted by cron, so there is a delay. Is it possible to get file deleted in real time, to avoid renaming of uploaded one?


texts: Can I deploy my Content on drupal using scripts?

texts:
If suppose I have a drupal application in Github and I have automated drupal installation using chef. Now I want to deploy that application content such that i can see it on my content page.
I am unable to put php and drupal tags due to reputation.


texts:
I have read Hide an entity with hook_entity_view_alter(), and by all rights this code should hide every paragraph on a page:

/**
 * Implements hook_ENTITY_TYPE_view_alter().
 */
function mymodule_paragraph_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  $build['#access'] = false;
}

There are no errors, I know the function is being called because the debugger stops there on a breakpoint, I've cleared cache with every test.

I've tried hook_entity_view, hook_entity_view_alter, hook_ENTITY_TYPE_view and hook_ENTITY_TYPE_view_alter.

None of them have any effect whether I'm logged in or not.

['#access'] is not showing up in the build array in any of these hooks which makes me think the advice might be out of date since 8.4 dropped? If it does work - why should it work?

Are there any other ways, better ways of hiding paragraph entities (or any entity really)?

Obviously there will be some logic involved later which is why I want to do it in one of these hooks (or similar).

Edit 1: It has been suggested that there should be a $build['content'] array or similar. There is only the entity object in whichever hook I try of the four I have listed:


texts: How do I interact with Mautic from a custom module?

texts:
I need to create a new contact in Mautic every time a new user joins my Drupal site.
Drupal.org has the following two modules:

https://www.drupal.org/project/mautic
https://www.drupal.org/project/mautic_api

I can't find documentation from any of these two modules on how to access the Mutic API from a custom Drupal module.
I believe, this could be done from inside a hook like this.
/**
 * Implements hook_ENTITY_TYPE_insert() for user entities.
 */
function custom_mautic_user_insert(Drupal\Core\Entity\EntityInterface $entity){

  // Some code here to access the Mautic API to create the new contact.

}

I have seen the code of https://www.drupal.org/project/commerce_mautic, which uses an event subscriber to do its work, but this seems very complex for such a simple task.


texts: Which of the following is better in terms of performance and speed?

texts:
I am creating a view and then using views_get_view_result() function to get the query and print a csv file
or
Creating a query using db_select and then using it to  print the csv.
Which of the above would give me quicker results


texts: How to remove the "No front page content has been created yet." message from the front page?

texts:
I only want blocks on the homepage. Because I don't have any nodes, and I want to keep the homepage as /node I am getting a "No front page content has been created yet." message on my page.

How do I get around this?


texts:
I am setting up a site for a web series. I would like to setup the site so that members can only stream an episode if they have already paid for it. We are using Vimeo PRO to serve our videos, and are using Video Embed Field to display the videos on the site.

If the member has not paid to stream this video, I would like to display a field other than the one with the embed code -- likely a field containing either a banner or a trailer for the show.

I found a video that somewhat outlines how to do this on a node-by-node basis, but I need to restrict access to just a field within the node, and not the entire node.

Is there an optimal way to set up this workflow?


texts: Programmatically adding argument to view that already uses a context filter

texts:
I have a view that uses the id of the currently logged in user as a contextual filter. This was set using the Drupal UI and works well. Then I wrote a custom module that adds another parameter (a specific node id) to all views on my site. All views need this second parameter (and it needs to be added programmatically). This approach works well for all views that only use the programmatically added parameter as a contextual filter. However, the view that needs 2 filter values does not work, because I think I do not handle the order of parameters in the args array correctly. How do I set up views that already use filter values, but I need to add more programmatically (I set $args[0], but I guess this might be the problem) ?

I should say that I do not want those filters to appear in the URL.

testmod.module:

function testmod_views_pre_view($view, $display_id, array &$args) {
  ...
  $args[0] = $value;
}

I thought I could just read the view's $arg array and add my special argument to it programmatically, but for the view that already uses the logged-in user as a contextual filter, when I print print_r($args) it is an empty array, although the view is working correctly (and only shows results for the current user). Are contextual filters that I set up via the UI stored in a different place than $args ?

What needs to be done to tell the view how to use the 1. and 2. filter values correctly ?

Edit: I read that hook_views_pre_view() is too early to find contextual filters in the arg array (at that point you would only see arguments in that array passed via URL). Which hook would be best to achieve what I'd like to do ?


texts: How do I make a form field go back invisble after I uncheck a radio button?

texts:
I'm currently building a form where the goal is that the administrator will have to choose between 3 radio buttons. If one click on any of the radios, a specific field shows up (There are 3 fields set as "invisible"). My issue is that, I have no problem making these fields show up, but they don't disappear if I select something else.

Here is my code:

function walk_handler_form_alter (&$form, FormStateInterface &$form_state, $form_id)
{
  $form['field_prestation_walk']['#states'] = [
  'visible' => [
    ':input[name="field_prestation_type"][value="walk"]' => [
        'checked' => true
      ]
    ]
  ];
}

So, as I said earlier, this code makes my forms show when I click on their related radios. However, if I click on another radio, they don't disappear.

I had a lot of troubles to find some documentation about that (well, I found some, but the examples given wheren't thorough enough for me). Also, I tried to add an invisible after the visible one, with the exact condition except that 'checked' was set to false, but it didn't work.

Should I use plain Javascript / jQuery for this, or am I just it the wrong way?

Thanks in advance


texts: how to display a custom entity in a view

texts:
This is my first time making a custom module and I want to display some of the content that is produced in a view, but I can't figure out how to make my custom entity show up in the SHOW: select list when making a new view.

What code do I need to add to my custom module to have it show up there?


texts:
So I am using hook_form_alter to alter the add-to-cart button for my Ubercart pages. See here:

function hook_form_alter(&$form, &$form_state, $form_id) {
  if ( !empty($form['nid']) ) {
    $node = $form['nid']['#value'];
  }
  else {
    $node = 0;
  }

  if (($form_id == 'uc_product_add_to_cart_form_'.$node) and ($form['node']['#value']->type =='product')){

    hide($form['actions']['submit']);

    $form['button'] = array(
      '#prefix' => '<button type="submit" id="edit-submit-'. $node .'" name="op" class="node-add-to-cart btn btn-cart">',
      '#suffix' => '</button>',
      '#markup' => 'Buy for: ',
      '#weight' => 1,
    );
  }
}

This works great. Except, in my form['button'] array, want to change the button markup to something like: 'Buy for: $10'.

How can I access the node's list and selling price so that I can use it in the markup of the button?


texts: Dashboard is empty for roles apart from admin

texts:
I want to create a role specific dashboard on drupal 7.
So I have added some blocks on the dashboard and also the "View dashboard" permission for this role.
However,when I login using the above role,the dashboard is empty.
What is the reason for this and how can I fix that?
P.S.Admin can see these blocks on dashboard


texts: How to use some code only in the template of selected content types?

texts:
I have some code (calling JS and CSS) in the head section that I only want to appear if the HTML template is used for the content type 'home page'.

I did it like this in the html template:

<?php if ($variables['node']->type = 'home_page'){ ?>
Code....
<?php } ?>

But if I check the source code of my pages, the code is showing up in all off my pages, not only on the pages that use the 'home page' template.

Any tips, code, links?

PS: I'm not good at PHP (I normally cut and paste)


texts: Main menu not showing on cck type content items

texts:
I have that annoying issue with my main menu not showing on nodes of one specific cck content type. The menu shows everywhere else and is set to do so in the block settings by using the Menu Block module.

I just don't get why it's behaving like this. Display of the node is done by using views & context / nothing special in the end. All fields which are visible are generated through views (in content type display settings, all are set 'hidden' - changing this, doesn't help).

Displaying the $page variable, the menu's aren't there, too. So which function should I have a closer look on for debugging?

The menu settings allow display everywhere (no restrictions), cache is disabled in the browser / doing drush cc often.

I'm accessing with user 1. (system is D7)


texts: Not sure how to work with beanstalkd module

texts:
I am looking to setup a queue system to upload large files (~150MB). For specific reasons we decided to do this using SFTP (phpseclib). After some research I came to the conclusion that I would probably need something like a work queue. I decided to go with Beanstalkd since there was a drupal module for it.

I have managed to get a Beanstalkd server running and add items to the queue.
But now I'm kind of confused as to how I would need to execute a specific script.

Can anyone help with this particular part of getting beanstalkd queue items to run in a non-blocking way?

Do I need to maybe write a shell script to run a php cli or am I looking at it all wrong?


texts: How can I get the term ID out of the hierarchical select theming function?

texts:
I'm attempting to add a link to flag each term output by hierarchical select in a views template.

Here's the relevant code from hs_taxonomy.module:

function theme_hs_taxonomy_formatter_lineage($variables) {
  $output = '';
  $lineage = $variables['lineage'];
  $separator = theme('hierarchical_select_item_separator');
  dpm($variables);

  // Render each item within a lineage.
  $items = array();
  foreach ($lineage as $level => $item ) {
    dpm($lineage);
    $line  = '';
    $line .= drupal_render($item);
    $line .= '';
    dpm($item);
    $items[] = $line;
  }
  $output .= implode($separator, $items);

  return $output;
}

And here's the output of dpm($item):

Based on the flag module documentation, I tried to add the link like this: $line .= flag_create_link('hobbies', $term->$item['#options']['entity']['tid']);

But that gives this error:
Fatal error: Cannot use object of type stdClass as array in /mysite/sites/all/modules/contrib/hierarchical_select/modules/hs_taxonomy.module on line 880

How can I get the tid of the term being output?