texts:
I have a bundle (content type) called "nbt_text" and a bundle "nbt_book". nbt_books stands for book node-type, and nbt_text -- for text node_type.

In nbt_text there is a field of "entity reference" type which keeps the information about books related to current nbt_text node.

Everything is fine but now the client asked me to add some extra fields, to be specific he wants the following thing: each reference field should contain not only the reference itself but also a field containing some bibliographical data, for example book pages where current text can be found.

In other words, the "related book" field should become now a kind of container that has two fields: entity reference field and a text field.

How can I obtain that? Am I to to write my own field module from scratch or I can someway use already existing great "entity reference" and "text" fields?

You will ask me why not simply add these fields to the bunch but the reason is that there can be not only one related books but lots of it. In that case the only way to use default fields would be keeping field data arrays in right order which is completely undesirable for editors.


texts:
Does anyone know what causes nodes to appear out of line when pulled to a view? Examples:

Photo profiles here:
https://international.permaculture.org.uk/about

Topics listed at the bottom of this page:
https://international.permaculture.org.uk/nextbigstep

I am wondering if it is because not all fields are populated - or because there are no teaser breaks and an uneven amount of body text?

Is there a way to stop this happening?


texts: Translate site name in multi language site

texts:
How can I translate site name for multi language site in drupal 8 ?
For Example:

in site/en -> site name : Hello
in site/fr -> site name : Bonjour


texts: Corrupted mysql cache_rules table - dropped the table and now I cannot create it anymore!? Stuck

texts:
I'm not sure how this happens, but the cache_rules table is corrupted and it prevents me from doing a drush cache clear all. I dropped the table successfully, but now I can't create it. Throws this error:

ERROR 1005 (HY000): Can't create table 'cache_rules' (errno: -1)

Luckily i have my db backed up and don't have to lose too much data. Now I tried to drop my entire database and that's not working neither. It does in fact drop all the tables, but it prevents the database from getting dropped entirely.


texts: Firefox/IE not displaying CSS with Drupal website

texts:
In Firefox and IE (and maybe others?) it seems that the blocks that are built by drupal aren't having CSS applied to them.

Any help at all would be wonderful, as the issue I'm having is not knowing where the issue lies. The site is http://confluencenter.arizona.edu/.

p.s.
I am very new to CSS and Drupal


texts: Adding a target='blank' attribute in D7 module for Nice Menus

texts:
I'm trying to add a target=_blank to all of the menu items inside Nice Menus. Has anyone ever figured this out?

I suspect that it's like adding title tag but I'm unsure.


texts: Copying prod multi-site installation to dev multi-site installation

texts:
I am attempting to upgrade my Drupal 8.9.2 multi-site installation to D9. I was hoping to work this all out on a development installation, that is located in a subdirectory of my home directory on my NameCheap Shared Hosting plan.
When I first installed this installation, I did so using the tarball method from years ago. I then followed the instructions given here (https://www.drupal.org/docs/installing-drupal/add-composer-to-an-existing-site). I was able to get the current running prod version converted to use composer with out an issue.
Before I go and start messing with the files, and attempting to upgrade to D9 through composer on a prod installation, I wanted to copy these files over to another installation where I can use it as a sandbox. To do this I:

copied the files on my server to a new directory
made clone databases for the new installation
truncated all the cache tables in the cloned DB
changed all the database settings in the settings files to point to the cloned databases

I've done this before without any issues, and now I seem to be getting a WSOD error on all the sites running from the new installation. The error I'm getting is

PHP Fatal error:  Uncaught Error: Class 'Drupal\Core\Cache\DatabaseBackend' not found in ~/{new installation dir}/public_html/index.php:16.

If anyone has any thoughts what's going on I am all ears.
Thank you in advance


texts: How to implement hook_views_query_alter?

texts:
I used this topic before asking question but even if the problem is very very closed, the answers given did not work for me.

So I need to alter the query of one of my views in drupal 7. I created a new module called for example 'mymodule'. This module contains

.info file.
.module file.
.views.inc file.

My .module file contains the following. Note that my .views.inc file is located at the root of the module directory. I also checked that my views api version is 3 :

function modulename_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'modulename'),
  );
}

My .views.inc file, which is at the root of the module directory contains the following :

function modulename_views_query_alter(&$view, &$query) {
dpm($view);
watchdog('error title', 'error message');
echo 'TEST TEST';
die('test');
if ($view->name == 'my_view_name' && $view->current_display == 'my_display_name') {
    unset($query->where[1]['conditions'][0]);
    unset($query->where[1]['conditions'][1]);
 }
}

I can't see what I am missing trying to implement this hook but it never go into the views_query_alter function (I cleared the cache before trying). I think I've followed all advices given in the link provided above.

Any help would be appreciated.


texts: $form_state['node'] Values Being Lost in Multistep Node Form After Ajax Click

texts:
I am really hoping someone might have an insight into this really troubling issue. I have got a custom node form which is presented as 4 multistep pages. In my third step, I have a bunch of ajax buttons which allow the user to save information. The problem is, after the ajax button has been clicked and we click the next 'page' button, all the $form_state['node'] values from the previous pages are being lost. So, consequently, when I get to hook_node_insert, I have empty values from the first 3 pages.

However, the weird thing is, this only happens in a couple of my ajax buttons in that page. I have a few other ajax buttons, which, don't cause any such problem. This is the definition for one of the problematic buttons:

<?php
    //Add the cancel button to cancel the "Add New Product" form
    $form['newproduct']['fieldset']['cancel'] = array(
      '#type' => 'button',
      '#name' => 'Add New Product Cancel',
      '#value' => 'Cancel',
      '#ajax' => array(
        'callback' => 'MyModule_NewProduct_Cancel_ajax_callback',
        'wrapper' => 'MyModule_NewProduct_wrapper',
        'method' => 'replace',
      ),
      '#limit_validation_errors' => array(),
      '#submit' => array(),
    );
?>

This is the callback for that button:

<?php
function MyModule_NewProduct_Cancel_ajax_callback($form, &$form_state) {
  //Return the add new product button
  return $form['newproduct']['addnewproduct'];
}
?>

I know that I might not have included enough code to see the full problem, but was wondering if there was any problem with the my ajax button element definition. Would appreciate any help on this. Thank you.

Update!!  - SOLVED - It was a limit_validation_errors problem.  I didn't have that set for my 'next' buttons in hook_form_formid_alter().


texts: How to check that an attribute not exists in an element with PHPUnit?

texts:
I'm trying to test that an element don't exists in a page. I know that exists the elementAttributeExists() method that checks that an attribute exists in an element. But I can't find any method like elementAttributeNotExists() to check that an attribute don't exists in an element.

So, with the following code I can check that the 'autocomplete' attribute is present in the #edit-pass element:

  public function testLoginForm() {
    // Going to the log in.
    $this->drupalGet('/user/login');

    // Checking that the autocomplete is not set.
    $this->assertSession()->elementAttributeExists('css', '#edit-pass', 'autocomplete');
  }

But how I can check that the autocomplete attribute is not present?


texts:
Is there any alternative to Panels that can be used for smaller websites where Panels may be a overkill?
I recently took up DP development again, haven't worked with DP7 for approx a year now, did lots of work on DP7 earlier.
When settings up a new site I always feel blocks are sufficient, if only the configuration had been made "correct" from the beginning - sorry for being biased.
But is the only alternative to blocks full blown Panels and mini panels if you want to be able to configure blocks differently depending on the the context in which they appear?
Update
after having tested Context and Display Suite I have to admit they fit perfectly! As stated by @j-reynolds in his comment, the Display Suite makes it possible to create column based layouts in which you can determine what data you want to see eg. splitting your node into a 2 column stacked view where body is in the left region and tags in the right, title goes into the header region.
Using the Context module you can control which blocks or regions are being shown based on eg. term view or node view.
Combining the 2 and you have something easy to work with and manageable without going full blown Panels.
Both modules can do a lot more, I am just mentioning a few of the options.


texts: I am using superfish menu in my website as a main horizontal navigation. on mouse over some links the drop down menu opens and it but due to lots of links its getting very long verticaly. Is there a way through CSS we can divide the first drop down menu into 2 columns. my website link is http://go2georgia.travel


texts: can I implement select_or_other just with core form API?

texts: Select (or other) works great but I want know can I implement its functionality with invisible key available for #states attribute described in form API


texts:
I am using the following code.

wk_elastic.info.yml

name: Blablabla
description: Blablabla
package: BlaBlaBla

type: module
core: 8.x

libraries:
  - wk_elastic/list-js

dependencies:
  - block

wk_elastic.libraries.yml

list-js:
  js:
    js/list.js: {}
  dependencies:
    - core/jquery

wk_elastic.module

function wk_elastic_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'wk_elastic/list-js';
}

The library is not being loaded.

What can I do to fix this?


texts: Taxonomy terms not translating on the edit/add node form

texts:
I'm trying to translate the interface on a drupal 7 installation but somehow the terms and the taxonomy names are not being translated.

The vocabulary names and the terms names are already translated and the field names were also translated but the node creation form are still just showing on the default language.

Has anyone had the same problem?

Here's the page where this is happening:
http://www.cuipcairo.org/ar/node/add/initiative


texts: How to push values from views attachment to Javascript?

texts:
I have a table view with both filters and exposed filters, and attached to it there is another view that uses views_aggregator_plus to display a summary of months and different value counts.

I want to have the attachment visualized so I attached ChartJs script to the page view and had another function loop through the attachment html table rows to fetch the data while separating each column into its own array.

This works though I am not sure. It doesn't feel right.
Wouldn't it be better if I pushed the values from the view directly to the script rather than have it done by the browser?

I am not sure about how to do it, but I found the values needed in hook_view_post_render under $view->style_plugin->rendered_fields..

How to proceed from there? Or maybe there is an entirely different and better way to achieve the same?

Thanks,


texts:
I have a content type 'homepage' containing one node which is used a the homepage. This node has a multivalue image field, and I need to randomly select one of those images to show on the homepage on every site visit. I have written the logic for this in the THEME_preprocess_node function in my THEME.theme file. This is working fine, but the site in question is still in development mode with most caching deactivated. I'm worried that once the site goes live and the caching is activated, it will serve the homepage from cache and therefore always show the same image until the cached version of the page expires.

Is that the case, or are the preprocess functions evaluated on every page visit even when the cache is active? If not, how can I circumvent this to get a random image every time?

This is the code I have written for this:

  $imgages = $node->get('field_frontpage_header_image');
  $random = $imgs->get(rand(0, $imgages->count() - 1))->getValue();
  $img = File::load($random['target_id']);
  $variables['random_header_image'] = ImageStyle::load('frontpage_header')->buildUrl($img->getFileUri());

I then use {{ random_header_image }} in the twig template. Maybe I can change this variable to a render array with a cache setting of max-age => 0? Not sure if this works in preprocess functions though ...

Thanks!


texts: Entityqueue - Handler drop down is empty after installation

texts:
I have just installed the Entityqueue module on my drupal 7x site. However, when I go to the /admin/structure/entityqueue/add page, the Handler dopwn down is empty and therefore the form will not validate so I cannot create a new list.

I've checked the \modules\entityqueue\plugins\entityqueue\handler folder and the simple handler is present along with it's class file.

Help!


texts:
The colorbox module functionality is now part of Drupal core media module, that is what i read in the colorbox project page.
However, I can't find documentation or guidelines how that actually works.
I have Drupal 9.0.3. installed and use media (images and video's) as fields as well as embedded in text (ckeditor)
I like to click on a Media image and make it full screen (with colorbox or any other method)


texts: How can I replace an image using a Form API?

texts:
I have a form that works great for adding fields, including and image, to a node and saving it.

I want to allow users to edit their fields and change the data, including their image.  I figure there is some way to retrieve and display the current image and then allow the user to upload and save/replace the image with a new one.  I can't figure out how to show a preview of the existing image on the Edit form.  I assume somewhere I should use File_Exists_Replace, but the rest is an overwhelming mystery.

Here is the code I use for the original form:

  $form['logo'] = array(
  '#title' => t('Image'),
  '#type' => 'managed_file',
  '#description' => t('Only image files will be allowed.'),
  '#default_value' => variable_get('logo', ''),
  '#upload_location' => 'public://misc/media',
  '#upload_validators'  => array(
    'file_validate_extensions' => array('png gif jpg jpeg'),
    'file_validate_size' => array(2*1024*1024),
    )
  );

And the submit function:

    // Load the file via file.fid.
    $file = file_load($form_state['values']['logo']);
    // Change status to permanent.
    $file->status = FILE_STATUS_PERMANENT;
    // Save.
    file_save($file);
    // Record that the module (in this example, cformtwo module) is using the file.
    file_usage_add($file, 'cformtwo', 'node', 1);
...
    node_submit($node);
    node_save($node);

I have spent days trying to figure out how to do this.


texts: Different Panels for page with & without argument

texts:
the scenario:
I do have the following path-auto configuration for Articles path:

domain.com/category/subcategory/article-title.

I woud like to use different panel for:

domain.com/category

and different for

domain.com/category/subcategory

So I have created basic page with alias domain.com/category and panel, where selection rules are:

URL path= 'category'
url path is not 'category/*/*' to allow displaying articles with their own paths
php code which checks if page has no arguments

On the panel I've  set the view with no contextual filter.

The second panel gots the same rules (except php checking if page has arguments) and is displaying second view with contextual filter and pane rule for fetching argument set to get argument from panel (first one).

the above combination is not working. I know I can set alias path directly in view but really want to use panels with views included for better power in page-elements.

Can anyone please tell me how to get it working - different panels for page with first argument, different without and no panel for page with 2 arguments.

Thanks for any help!
The second panel


texts: Which Drupal versions are affected by the vulnerabilities in advisory PSA-2016-001?

texts:
There is an PSA about the 2016-July-13 Security Advisory of several critical updates:

  View online: https://www.drupal.org/node/2764899

  Advisory ID: DRUPAL-PSA-2016-001
  Project: Drupal contributed modules
  Version: 7.x
  Date: 2016-July-12
  Security risk: 22/25 ( Highly Critical)
  AC:None/A:None/CI:All/II:All/E:Theoretical/TD:All 1
  Vulnerability: Arbitrary PHP code execution

  DESCRIPTION

  There will be multiple releases of Drupal contributed modules on
  Wednesday July 13th 2016 16:00 UTC that will fix highly critical
  remote code execution vulnerabilities (risk scores up to 22/25 [2]).
  The Drupal Security Team urges you to reserve time for module updates
  at that time because exploits are expected to be developed within
  hours/days. Release announcements will appear at the standard
  announcement locations. [3]

  Drupal core is not affected. Not all sites will be affected. You
  should review the published advisories on July 13th 2016 to see if any
  modules you use are affected.

The advisory only mentions version 7.x as vulnerable, but I realized that I'm not entirely sure how I can interpret that. My interpretation is that Drupal 8.x should not be affected by these issues. But I'm really not sure about Drupal 6.x.

Drupal 6 is no longer supported. Does that mean that this kind of advisory won't even mention if it is still vulnerable? Or can I interpret this one as only version 7 is affected?

Which versions exactly are potentially affected by this advisory?


texts: When to create schema while working with config entity?

texts:
We have a custom form mymoduleForm.php that is used to perform some logic by calling mymodule_preprocess_node(). We were able to add addCacheableDependency() and now the mymodule_preprocess_node hook is able to pull the latest changes even after making several changes and clearing cache.

We did not create a mymodule.schema.yml as this configuration is not used for translation or any other way then to store some value in the some_field field.

Although it appears to be working just fine without the mymodule.schema.yml file, we were wondering if it is needed. We need some guidance on whether or not this is a situation where the mymodule.schema.yml is needed (or if it always needed).

mymoduleForm.php

class mymoduleForm extends ConfigFormBase {
  public function buildForm(array $form, FormStateInterface $form_state) {
    if (!$this->entity->isNew()) {
        \Drupal::service('renderer')->addCacheableDependency($form, $this->entity);
      }

    $config = $this->config('mymodule.settings');

    $form['some_field'] = [
      '#type' => 'textarea',
      '#title' => $this->t('Some field title'),
      '#description' => $this->t('some description'),
      '#default_value' => $config->get('some_field'),
    ];

    return parent::buildForm($form, $form_state);
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->config('mymodule.settings'),
      ->set('some_field', $form_state->getValue('some_fields'))
      ->save();
  }
}

mymodule_preprocess_node

function mymodule_preprocess_node(&$variables) {
  $config = \Drupal::config('mymodule.settings');
  // add the cache tag, so that the output gets invalidated when the config is saved
  \Drupal::service('renderer')->addCacheableDependency($variables, $config);
  $config_value = $config->get('some_field');

  $library = 'mymodule/some-library';

  if($config_value == 'some_value') {
    $variables['#attached']['library'][] = $library;
  }
}

This is a follow up question from How to clear cache for config entity after making changes?


texts: rewrite taxonomy view results with parent/child when some terms have no parent

texts:
I would like to make a tree of taxonomy terms and keep the child-parent relationship.  So something like

-Parent1
--Child1
--child2
-Parent2
-Parent3

I couldn't find a way to do this with core, so I'm using the Views Tree module.  By following the instructions on the module page, I can output a hierarchical, bulleted, unordered list with proper indentation for the child terms.  However, I want to rewrite the fields as links like:

test/parent1
test/parent1/child1
test/parent1/child2
test/parent2
test/parent3

I'm using Fields:

 - Taxonomy term: Term ID
 - (Parent) Taxonomy term: Term ID
 - (Parent) Taxonomy term: Name
 - Taxonomy term: Name

only the last field is visible, and I have a relation "Taxonomy term: Parent term".  All this is per the instructions on the Views Tree page.  When I try and rewrite the field link using Fields->'taxonomy term: Name'->Rewrite Results->Output this field as a link->Link Path and use the replacement patterns in the form:

test/[name]/[name_1]

('name' references the term's parent name (if it exists); name_1 references the term name itself) it works fine for the child terms, since both parent and child are defined, I get:

test/<term's parent name>/<term name>
(e.g. test/Parent1/Child1)

However, the parent term links are rewritten as:

test//<term name>
(e.g. test//Parent1)

since the parent terms themselves have no parent.  Any suggestions on how to make this work?  I'm willing to scrap this module and try something else, but I couldn't get it working with core either.


texts: Prevent path based breadcrumb in theme, or, don't show breadcrumbs for 403/404 responses?

texts:
I am looking to do one of these solutions for a users 'contact' page. When a user has unchecked "Personal Contact Form", and someone accesses that URL (user/id/contact), the breadcrumb displays the users username in the breadcrumb.

The username in the breadcrumb is not desirable, because some people make their email address their username, so:

How can I disable the breadcrumb from displaying on 403/404 responses, or
How can I disable the path based breadcrumb service outright?


texts: Clicking reset in Views UI causes PDOException Error

texts:
I have a searchable view created that returns the following error when I click to  "reset" the search query. It only occurs when resetting a search from the search terms field.

  An AJAX HTTP error occurred. HTTP Result Code: 500.

The logs show the following:

  PDOException: You cannot serialize or unserialize PDO instances in
  DrupalDatabaseCache->set() (line 455 of /code/includes/cache.inc).

This error occurs in the preview, not on the live page.


texts: link to node field on another content type

texts:
I have a field that uploads a pdf, I want to get the uri in another node and content type to create a link.

Is this possible to do without knowing the id of the node (so not using node_load) but by the field name? I tried to create an existing field in my node (see screen) but this seemed to just provide a duplicate field without the already uploaded pdf.

The idea is have the users upload the file in one place.


texts: How to build an editable view of two entities linked together?

texts:
I started using drupal recently and i am stuck building an editableview.

In my view i have a table of users with a field of a content type "survey" associated to theim throught an entity reference field that i added to the user account's fields.
i set up a view of user with a relationship to my entity reference field.

I want to edit the field "active" wich is a field of content type "survey"

At the moment i can edit the field but it will set the value for every content.

i wish to edit the value of desired content not for all the content of this content type.Is their a way to achieve the desired result?


texts: How can I limit Webform submissions by date

texts:
I want to have a select list on the webform node with options to decide how many times each user may submit the form. for example once a day, once a week, once a month... How can I do it?
Thanks!


texts: How to add more image styles to an image element in a content type

texts:
I have a image field in my content type. In that field the images should be saved in two image sizes. As an example when I uploaded a photo it should save as two photos. One for 200x200 px and one for 360x360 px.

When I change the function settingsForm(array $form, FormStateInterface $form_state) in ImageWidget.php as below it applies to the all image tags in content types.

public function settingsForm(array $form, FormStateInterface $form_state) {

    $element = parent::settingsForm($form, $form_state);

    $element['preview_image_style'] = [
      '#title' => t('Preview image style'),
      '#type' => 'select',
      '#options' => image_style_options(FALSE),
      '#empty_option' => '<' . t('no preview') . '>',
      '#default_value' => $this->getSetting('preview_image_style'),
      '#description' => t('The preview image will be shown while editing the content.'),
      '#weight' => 15,
    ];

    $element['main_image_style'] = [
      '#title' => t('Main image style'),
      '#type' => 'select',
      '#options' => image_style_options(FALSE),
      '#empty_option' => '<' . t('no preview') . '>',
      '#default_value' => $this->getSetting('main_image_style'),
      '#description' => t('The main image will be shown when opening the popup.'),
      '#weight' => 14,
    ];

    return $element;
}

I need to do this only for a selected content types selected image field. Is there a way to do this?


texts: Configuration export/import doesn't work

texts: I did a drush config-export staging on a local version of my site then a drush config-import staging on the server. It imported all the taxonomy vocabulary but no terms. I also tried it via the UI (Configuration->Development->Configuration Synchronization). Is this a bug or just the unfinished nature of Drupal 8?


texts: hook_views_post_execute additional results not showing up

texts:
I'm trying to conditionally add a few results to a view display, this seems to be working in that when I print the $view object after the changes it works as expected, each of the addition objects matches the format of the objects already contained in the views result set exactly.

Unfortunately when I visit a page with this view, even though the additions are present in the view object, they are not present in the rendered view. Is there something I'm missing? I've seen similar code snippets in several places that people say work..

function mymodule_views_post_execute(&$view) {

      if($view->name == "zohar_body_feed" && $view->args[0]==37) {
        global $user;

        $ir_chapters=db_query("SELECT ct.field_chapter_value AS chapter, n.nid, n.title FROM node AS n LEFT JOIN content_type_book_body AS ct ON n.nid=ct.nid LEFT JOIN term_node AS tn ON tn.nid=n.nid LEFT JOIN term_data AS td ON td.tid=tn.tid WHERE td.name='%s' AND n.type='zohar_body' ORDER BY ABS(chapter)",'Idra Raba');

        while($irc=db_fetch_object($ir_chapters)){
            $temp = new stdClass;
            $temp->nid=$irc->nid;
            $temp->node_data_field_chapter_field_chapter_value=$irc->chapter;
            $additions[]=$temp;
        }
        $results = array();
        foreach($view->result as $single_result) {
          if($single_result->node_data_field_chapter_field_chapter_value == 13) {
            foreach($additions as $addition){
                $results[] = $addition;
            }
          }
          $results[] = $single_result;
        }
        // replace the old result array
        $view->result = $results;
        if($user->uid==1) drupal_set_message('<pre>'.print_r($view,1).'</pre>');
      }
    }

I am using Views 2 on Drupal 6


texts: How to get a specific field in a table layout in Views templates

texts: This is my first time using a table to display a Views template. How do you access a specific field so you can reorder them one by one yourself? I have 3 fields I want to place but I want one of the fields field_house to come out first, followed by field_door and field_table. I'm also asking so I can wrap each one in their own class making it easier to layout.


texts: How do I prevent D7's ajax_deliver() from loading CSS?

texts:
For some crazy reason, using ajax_deliver() in a menu callback is causing 4 theme CSS files to be loaded into my page, breaking the page styles.

What I'm doing:

Using Seven as my admin theme
Created a basic admin page for a module
Admin page has a link (no form) which should return content via AJAX
Link points to a menu path which uses a custom callback
Custom callback uses the /nojs trick and returns content via ajax_deliver()

What's happening:

AJAX content is loading into the page just fine, working as expected
4 Bartik CSS files are being dynamically added to my admin page (using Seven theme)

Anyone experienced this? Any ideas on how I can prevent this CSS from loading?


texts:
I am new to drupal, and i am trying to alter the code generated by my main menu. I would like to replace this :

Link1

link2

By this :

Link1
link2

The code i have added on my page.tpl.php

print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix'))));

I have been looking around and found that it could be achieved by using theme_menu_link & theme_item_list in my templatye file....no success so far.

Can anyone show me the proper way to do it ?
Thanks


texts: Embedded views into another view via twig_tweaks, but the results only update after clearing drupal caches

texts:
I have a view that needs to embed child views, which I did using the twig_tweaks module to insert the child view as a field in my parent view, by using a custom text field:
{{ drupal_view('my_child_view', 'block_1', arguments.null, tid) }}

The first argument arguments.null is the group id, which the child views get from the URL
example.com/group/58/parent-view
It all works perfectly when i view the results for a given group id. However, when I then open the view for another group id, I get the results for the first queried group id. The results will only change after i delete the Drupal caches. Then I can display the view correctly for any group id, but afterwards, it will again never change the results.
My best guess is that the results of the embedded view are cached? Is there any way to disable this? I tried including {'#cache': {'max-age': 0}} into the custom text embedding the child view, but this did not help either.


texts: Best hook to use to save a new node when a node is saved

texts:
I want programatically create a new node of type B (status message),
immediately after a node of type A (e.g. gallery post) is added (or updated).

Looking at this recipe, I see that I will have to add hook_node_insert inside my module and call node_save to save the new node. But on the comments to the hook_node_insert docs ndvo claims I can't call node_save in the middle of another node_save operation. So what is the best approach to use?


texts: How to make possible to flag only one node

texts: I have a view with lists of 10 nodes with a node display type (not rows). Every node has a flag. How to make possible to flag ONLY one node of these 10 nodes, for example if you have flagged one node - you cannot flag another one untill you unflag flagged one. Just like a best answer functionality on this site. Thanks :)


texts: Okay, I'm not sure if this question should be here, but it's more of a general question. So I'm hoping if anyone can relate to this, perhaps you can suggest something to get around this. So I worked on this particular site. Using drupal 7. It's a kind of article site and content is about anything out there, nothing specific, it's more on the fun side. Since we've allowed sign ups, we've been getting a lot of sign ups of users, but most of them seem to be a group of spammers or trolls. No matter how much I try to contain it, they just keep coming and sign up. I have enabled captcha to prevent bot signups, as well as on the commenting sections so we don't get tons of spam more than we can handle. I also enabled sign up approval so I could see who signed up, and for sure everyone of them have tell tale signs of spammers. Imagine usernames that don't make sense. Randomly generated or whatever. Should we ban the ips, or the email domain names? No room for just one question, it may be all general but it concerns the whole site in itself. Not sure what the work around is, but I sure appreciate any suggestions from those who got around this. Thanks. Cheers.


texts:
I am trying to import a node reference in my users's profile using feed and feeds profile modules and using a CSV file like this:

"Name","Email","Team"
"Pepe","Pepe@example.com","Team A"
"Juan","Juan@example.com","Team B"
"Pedro","Pedro@example.com","Team C"

My mapping configuration is like this:

SOURCE         | TARGET                                        | TARGET CONFIGURATION
Name             User name (name)                                Used as unique
Email            Mail                                            Used as unique
Team             team nid nid (profile2:main:field_team_nid_nid)

Team is a node reference to a content type that I had created.
When I try the import y receive this error message:

Invalid data value given. Be sure it matches the required data type and format.


texts: Call Remove Button (File Upload) Programmatically using JavaScript

texts:
How can I call the remove button of temporary uploaded file programmatically using JavaScript?

I want to clear the form fields when the condition changes. I've done all the form fields exept the temporary uploaded file.

Can I call the remove function? If yes, Where is it?


texts: What's the correct way to make it so that node_load both loads and caches additional, custom data?

texts: For example, I'd like node_load to load the path alias of the node, and cache it for future node_load calls (just like node_load caches all of the data, i think). I assume this is done in a module, but I haven't been able to find examples of this.


texts:
I am trying to create a link in page.html.twig that points to an alias. The code {{ url('node/1') }} shows an unexpected error, whereas {{ 'node/1' }} works fine but goes to url website/node/1.

In D7, one can use <?php echo url('node/1'); ?> and be directed to the page with proper alias.

What code can be used in D8 to display correct alias url?


texts: Pathauto won't turn off on specific node

texts:
I'm using pathauto, but I want to use a custom url alias on some of my nodes.

I edited my node, unchecked the Generate automatic URL alias checkbox and typed my custom url into the path box and clicked save.

This is the value I typed: blog/blog.cfm/aid/496/Test-url-alias

I don't get any errors when I save, but the url doesn't seem to take effect. When I edit the node again and go look at the url alias the Generate automatic URL alias checkbox is checked again. My value is still in the text field, but the field is disabled because the checkbox is checked meaning it should use an automatic alias.

Why won't my changes stick and use my custom url alias?


texts: Contextual filters in views rest export for decoupled website

texts:
I'm running a Drupal 8.3.2 site and currently explore the concepts of using Restful webservices, jsonapi and React.js in a progessively decoupled project.

I installed the jsonapi module and fetched some data using axios and a small react.js app that gets mounted in a custom drupal-block on the front-page of my site. This all works and making use of jsonapi's sparse fieldsets, includes, filters etc. works well. However, the site uses lots of Drupal views that work with contextual filters and extracting the data I want to show is easy to do with views. I could of course use the power of the jsonapi and just "duplicate" the view with an axios GET request. However, since the view already provides all the content/filters I want, making use of the view via Rest-export would be nice.

My views use contextual filters. Some of them I provide via a hook_views_pre_view() adding values from the user's private_tempstore Session object to the view's $args array, some are just the user Id of the currently logged in user - set via the view's UI. When using a Restexport of this view and displaying the data inside the react app on the site's front page (using axios.get(http://localhost/website/rest/exampleview) in React.js , it works well even without specifying the contextual filter values in the GET Url.

Is this approach safe as long as the React app is running on the same server inside the same browser? I guess it's not fully clear to me if this always works and what exactly happens in the background (i.e. in my example I am the only logged in user, but what happens when a second user is also logged in and sends a GET request using the same endpoint/rest-path?)


texts: Customizing the way the form is displayed to admin user

texts:
I am developing a module which requires an administrator form.The admin will enter some settings data which will be saved in database.Then i will use these settings to display information to the website users depending on the settings chosen by admin.

So for administrator screen i need the form to be displayed like this

HEADING_ONE    HEADING_TWO     HEADING_THREE     HEADING_FOUR
TEXTFIELD_ONE  TEXTFIELD_TWO   TEXTFIELD_THREE     TEXTFIELD_FOUR

I need to have a table like structure. How can this be done?


texts: Unable to configure SMTP authentication support module

texts: In Drupal v7.36 & 7.37, after installed and enabled SMTP Authentication Support module, I still can't find the menu function under configuration/system to config this module for all related email setting.


texts: how do i add a login menu to superfish menu module?

texts:
I thought i would be able to add the default User Login menu to a Superfish block, but it doesn't appear in the drop down list to be able to select when configuring the Superfish block.

Can anyone advise how to create a login menu for superfish that disappears when users are logged in. I have my Main Menu in Superfish 1 block, and my User Menu (contains logout) in my Superfish 2 block (works perfectly as only appears when logged in), and wanted a Superfish 3  for User Login (to only appear when logged out).

Perhaps there is an easier way to do this, so open to suggestions?


texts: Comments with Facebook Auth User and anonymous

texts:
I'm working in a site that needs some special behavior for comments.

The user will have anonymous and users connected with Facebook.

For comments, the site needs to allow anonymous comments posting but if the user is connected with Facebook the page will permit to the user make the comment with Facebook or as some anonymous user.

I been googling for a couple of hours some module that provides this functionality out of the box but I was not able to find one.

Does anyone knows some module to recommend me ?

Thanks in advance !


texts:
I want to enable Menu Primary tabs in my site, but I can't find how to enable them.
Any suggestions please?


texts: Can I use a theme done for the previous version in the latest core version?

texts:
Is it possible/advisable to use a Drupal 7 theme on a Drupal 8 installation?

I'm starting my first Drupal 8 project. Generally, I hit up a place like ThemeForest for a theme, but their D8 theme selection is depressingly slim. Can I use a (highly rated and actively maintained) D7 theme instead? Is there a better place to look for professionally built D8 themes?


texts: Simple drop-down "list" items (inside a html "body") --- content (un)hiding upon click --- Not a navigation bar, no redirect, no menu, no forms

texts:
I would like to ask if it were possible to have certain content (nothing too special, just regular lines of text with standard formatting) on a html article, like e.g. ordered in a list, which can be unfolded (or hidden again) by a mouse-click?

When searching information on this, I easily come by navigation drop-down menu's; but a navigation side-bar or top-bar is not what I am looking for.
I have found another question asking for something similar, but wanting to be redericted to another page (similar to a navigation menu), that is also not what I want to do: I do not want to navigate to another page.

I would simply like a drop-down "list" inside a html's "body" article. The visitor should be able to open or close these "frames" or "list items", e.g. by clicking on the title or on a list button. I am just looking for a "1-level-depth" list.

It would be nice if the items had a title and a number, ordered vertically, like a regular ordered list:

>click to unfold< List item 1
>click to unfold< List item 2
>click to unfold< ...

If, for example you would click on list item 1, the content of list item 1 would show:

>clicked, click to hide content again< List item 1
<<< Content of list item 1, which is just standard lines of text, perhaps with standart formatting. >>>
>click to (un)fold< List item 2
>click to (un)fold< ...

The text I have put between ">"..."<", is just to clarify; isn't specifically needed. This could just be a triangular list bullet for example, which could just change by pointing downwards when clicked.

Is this possible by using a Drupal module, or perhaps just via html code?

Any help on this would be greatly appreciated,

Vincent Verheyen.

P.S.: I am very new to Drupal and understand the basics such as installing modules.


texts:
How can I embed the output of a view in another page, as a JSON Data Document, without stopping the page processing ?

I have a view with format set to JSON data document and am attempting to embed the block output in a node with views_embed_view('nec_map_data','block').

This embeds the block but with Views API mode unchecked page processing is stopped at the JSON and the page doesn't render.

If I enable Views API Mode then the block output is wrapped in a div.

I would like the JSON output from the view to be assigned to a javascript variable in the node. How can I achieve this ?


texts:
Let's consider a views on an entity named :"Person" .
"Person" has a field named "id" (the primary key)
"PersonTag" has a field named "person_id" (this field is referencing the id of "PersonTag" entity.

My issue is that I want to display in this views the fields of "PersonTag".
First idea was to try to implement a join with Person using hook_views_query_alter() . That was the main purpose of this question.
Well now I'm having the join on my query, but  can't figure out how to display the fields (of the join table) in my views.

So after some searches, I realised that I should use hook_views_data() as it explained in this question.

In documentation of hook_views_data() it's mentionned that:

  To provide views data for an entity, instead of implementing this
  hook, create a class implementing
  \Drupal\views\EntityViewsDataInterface and reference this in the
  "views" annotation in the entity class.

Since I'm having this class already created, I tried to implement my join in there.
Here are the code implemented:

 class PersonViewsData extends EntityViewsData implements       EntityViewsDataInterface {

/**
 * {@inheritdoc}
 */
public function getViewsData() {
$data = parent::getViewsData();

$data['person']['table']['base'] = array(
  'field' => 'id',
  'title' => $this->t('Person'),
  'help' => $this->t('The Person ID.'),
);

 $data['person']['table']['join'] = array(

'person_tag' => array(
  'left_field' => 'person_id',
  'field' => 'id',
  ),
);

$data['person']['id'] = array(
'title' => t('Example '),
'help' => t('Example'),
'relationship' => array(
  // Views name of the table to join to for the relationship.
  'base' => 'person_tag_field_data',
  // Database field name in the other table to join on.
  'base field' => 'person_id',
  // ID of relationship handler plugin to use.
  'id' => 'standard',
  // Default label for relationship in the UI.
  'label' => t('Example '),
 ),
 );
return $data;
 }
 }

This code doesn't work, I don't see any field appearing in my view.

Would help me to figure out the solution?


texts: How to move my site files outside the Drupal folder on local computer?

texts:
I like the Windows file structure that keeps program files separate from my data files. This allows me to organize my stuff logically by content and makes it easy to do regular backups of all of my stuff without needing to back up the program files, which are more easily replaced if necessary.

I have several websites that I've developed in ASP over the years and I keep the HTML, ASP,
and other content files for each site in subfolders of a folder called "Web root". When I want to update a site, I first test the changes locally and then just FTP the modified files from the correct "Web root" subfolder to the online server.

Can this philosophy work for Drupal?

I'm now looking at revamping those sites in Drupal and I'd like to keep this separation of program and data files if I can. I've installed XAMPP and am getting ready to install Drupal. I've figured out how to move the MySQL "data" folder out of the MySQL folder and confirmed that the configuration works, so that's taken care of. Now the question is how to do the same thing with the site content files for Drupal.

What I want to do is keep the Drupal core along with downloaded modules and themes in XAMPP's "htdocs" folder where they're designed to go, but put content that I develop elsewhere outside the XAMPP folder. I think this means basically the contents of subfolders of the "sites" folder.

Can this be accomplished with configuration settings or symlinks or some other method?

I found the following related forum post that recommends symlinks:

Store Drupal files outside of the root

but it only talks about putting the contents of the "files" folder elsewhere. I don't know Drupal enough yet to know if that's enough or if I need to be able to put other contents of "sites" subfolders elsewhere as well.

Can someone point me to information on how to do this?

Thank you.


texts: Managing Drupal Core in Git for Aegir Platforms

texts:
We've started developing a platform to deploy sites with using Drupal 7.2. The platform is managed in git. However, as we do not touch core, what is the best place to managed core?

Should core also be in git on its own repo? Or should the dev team update core as they develop the platforms, and push core with the platform?

Thanks!


texts: How to check which node should be posted on which domain?

texts:
I am looking for a feature which should be able to check the node destination before save it in the database.
This will be used in multi site  Drupal set up.

And it must be work like if node 1 has already created in site1 and I want to save node 2 in site2 then it save the node with nid=2 in the site2's node table.

Which means the nid must continues its sequence regardless of domains. Here, database and codebase are same only tables are having different prefixes.


texts: How can I add points for selected answers to questions implemented using Polls?

texts:
The users of my page have to answer a test, which I'm making with the Polls module.

I have a custom currency called "points". The users points have to grow when they answer the test correctly, in order to buy things in the store with Drupal Commerce.

I really don't know how to do this, any suggestions?


texts: Delete query is called while updating the value of node

texts:
Delete query is called while updating the cck field value of node.

After debugging i find following code in

  var/www/drupal-7.40/modules/field/modules/field_sql_storage/field_sql_storage.module

in field_sql_storage_field_storage_write($entity_type, $entity, $op, $fields)

we have following code

// Delete and insert, rather than update, in case a value was added.
if ($op == FIELD_STORAGE_UPDATE) {
  // Delete languages present in the incoming $entity->$field_name.
  // Delete all languages if $entity->$field_name is empty.
  $languages = !empty($entity->$field_name) ? $field_languages : $all_languages;
  if ($languages) {
    db_delete($table_name)
      ->condition('entity_type', $entity_type)
      ->condition('entity_id', $id)
      ->condition('language', $languages, 'IN')
      ->execute();
    db_delete($revision_name)
      ->condition('entity_type', $entity_type)
      ->condition('entity_id', $id)
      ->condition('revision_id', $vid)
      ->condition('language', $languages, 'IN')
      ->execute();
  }
}

May be someone explain why ?
And also can i use update Query instead of delete, insert ?


texts:
I only know the title of a node, and I want to load the node using node_load().

How do I do that?


texts:
In my angular app, I am trying to use headless Drupal using service module. I can't able to find a proper documentation to handle session authentication for each subsequent calls. My each request ends in "csrf validation failed" message.

Can anyone suggest a good tutorial or steps to handle session authentication?


texts: How to alter a views result in drupal 8?

texts:
Description:

I have 3 content types:

A property, that has for example a field address and a field "number_of_rooms"
A property_type, that is like an abstract property, having also number_of_rooms, but no address, because it belongs to...
A development, that has a number of property types and an address

I want to do a search over properties or property_types, filtering by number_of_rooms, but displaying the related development if the result is a property_type and without duplicates.

Example:

Home | 2 rooms | Address 1 | type: property
Greentree Urbanization | Address 2 | type: development

Type A | 2 rooms | type: property_type
Type B | 3 rooms | type: property_type

I want to search for "rooms < 4" and the results should be something like this:

Home | 2 rooms | Address 1 | type: property
Greentree Urbanization | 2, 3 rooms | Address 2 | type: development

What I did:

I was able to create a view that shows all the results for the property and property_type content types, showing also the referenced development but with duplicates. Like this:

Home | 2 rooms | Address 1 | type: property
Type A | 2 rooms | type: property_type

Greentree Urbanization | Address 2 | type: development

Type B | 3 rooms | type: property_type

Greentree Urbanization | Address 2 | type: development

I now want to alter the view results merge the developments so they only appear once. I created a module with a hook_view_pre_render().

How do I create and render what I want?
Do I need a custom entity?
How do I output this to the twig template?

Or maybe there is another way to do this that I couldn't think of...


texts: How do I create dynamic routes where the changing part is at the beginning of the path?

texts:
I need to create custom module routes like the following.

/ireland-dummy-page (IE)
/uk-dummy-page (UK)
/dummy-page (global)

How can I write the route paths for this scenario? Do I want to write separate ones or is there any way to make this dynamic?
my.calculator:
  path: "/{con}-dummy-page"
  defaults:
    _controller: '\Drupal\calculator\Controller\CalculatorController::CalculatorPage'
    _title: "Dummy test page"
  requirements:
    _permission: "access content"
  options:
    no_cache: "TRUE"


texts: Can I use Node Reference Field as a Text Field if there are no references?

texts:
I'm creating a content type Event. I want to reference the node of another content type Venue, so the user will be able to click to the venue node from the event.

To reference the venue on the Event creation page, ideally it would be a text field with autocomplete showing a list of possible venue nodes.

Now if the venue node hasn't been created yet, can Drupal allow the Event to be created using the entered text as display (i.e plain text)?


texts: How to use the "Render Views filters as select list" option in an Entity Reference field?

texts:
I have a content type Trait, that includes an Entity Reference field Trait Type. A trait type is categorized under a Trait Category. For my Trait content type form I  created an Entity Reference View for as follows:

As (if) you can see, I have included a contextual filter that takes Trait Category id values. I've also added a relationship for Trait Type and Trait Category.

The view works as expected, when I enter trait category id values I'm able to filter related trait types.

My difficulty comes when my I want to use this view as my datasource for a Entity  Reference field (Trait Types List) I want to add to my Trait content type form.In the field settings field for the Triat Types Entity Reference Field I've done the follow:

Now what I can't understand is:

What View Arguments is supposed to take and do I need to give it any value?
Shouldn't the option "Render Views Filter as a select List" a new select widget to my Trait content type form that would allow me to filter my Trait Type Entity Reference select widget?

Something like this perhaps:

Is my expectation wrong? How can I use this option?


texts: modules for building ajax application and friendly urls?

texts:
I'm building an ajax application using drupal 7, i found a module with some help ajax_nodeloader, but also i need load panel pages, views, etc.

Until now i'm overriding template theme file (zen) for ajax requests, and trying to use jquery address for good seo.

Also i will use jQuery UI Layout Plug-in on my template.

Which modules do you recommend ?


texts: Making new variable for a theme function shows an error notice

texts:
I am trying to make a new variable for a theme whose name is ntheme. I have defined the following function in template.php.

function ntheme_gnu_preprocess(&$variables) {
  $variables['disclaimer'] = t('Comments are unaythorized. The views expressed are those of the comment author.');
}

I used $disclaimer in the comment-wrapper.tpl.php template file.

<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php if ($content['comments'] && $node->type != 'forum'): ?>
    <?php print render($title_prefix); ?>

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

    <?php print render($title_suffix); ?>
  <?php endif; ?>
  <?php print render($content['comments']); ?>
  <?php if ($content['comment_form']): ?>

<?php print t('Add new comment'); ?>

    <?php print render($content['comment_form']); ?>
  <?php endif; ?>

<?php print $disclaimer; ?>

I get the following warning.

  Notice: Undefined variable: disclaimer in include() (line 39 of C:\wamp\www\drupal\sites\all\themes\ntheme\templates\comment-wrapper.tpl.php).

What am I doing wrong?


texts: Change page.tpl template inside a hook_menu callback

texts:
I have a hook_menu like that:

function mymodule_menu() {
    $items['mymodule-test'] = array(
        'page callback' => '_mymodule_test_callback',
        'access callback' => TRUE
    );
    return $items;
}

and the callback function:

function _mymodule_test_callback()
{
    // processing
    return $html;
}

I googled around but i cant find how to force the page template inside my _mymodule_test_callback function.

Edit: why i cant (or dont feel comfortable with) url-based suggestion

Url-based suggestion are easy to implement, however they can not completely fit my needs.

The template I have to use is determined in the _mymodule_test_callback function, according to very various aspects, for example:

Does exists a node of type 'foo', and does the field 'abc' value's be 'xyx'? => choose template 'page-mymodule-foo.tpl.php'
The node does exists, but the field 'abc' value is empty? => Choose temlate 'page-mymodule-bar.tpl.php'
The node does not exist at all, but the user has the 'bimbumbam' role? => Choose template 'page-mymodule-foobarz.tpl.php'

...and so on.

I know this is a rare behavior, and that i could redirect instead of switching template, but actually the function body is not big and i prefer to do this way.

Is not possible?


texts: Comma seperated text field into a HTML ol

texts:
I have created a custom content type and one of the fields will be a texfield with values separated by a comma e.g.

value 1, value 2, value 3

I want to then display this as an unordered list in the output.

Can anyone help with how this can be achieved?

Thanks


texts:
I need help in using hook_theme in my custom module. Any good examples is much appreciated. I have created a CCK input form and I want to theme the input form using hook_theme. The content type is created using hook_install().

I have used hook_form_FORM_ID_alter() to alter the theme of the input form. Following is the code for that.

 function footer_menu_form_footer_menu_node_form_alter(&$form,&$form_state,$form_id) {
   theme('footer_menu_node_form', array('form' => $form));
 }

 function footer_menu_theme($existing, $type, $theme, $path) {
   return array('footer_menu_node_form' => array(
     'arguments' => array('form' => NULL),
     'template' => 'footer-menu-node-form',
     'render element'=> 'form',
   ));
 }

I have also created a footer-menu-node-form.tpl.php file inside the module, and the following is the code in the template file.

 <?php print drupal_render($form['title']); ?>

Menu Tree

 <?php print drupal_render($form['title']); ?>
 // this one is for rendering all the remaining items, like hiddens:
<?php print drupal_render($form); ?>

When I load the footer menu content type. The content within the
 tag is alone printed and then I get the following error:

  Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40961 bytes)

Can anyone tell me what I doing wrong, or could anyone suggest me an efficient way to use hook_theme() in modules?


texts: my articles publish even when I deselect publish

texts:
I'm an admin user type with publisher priveges as well. When I save an article, it is always save as "published". Even when I uncheck "published" under "publishing options" it saves as published.

In other words, I make sure "published" is deselected, and when I save and edit the article, the "published" select box is ticked.

My goal here is to save the content as unpublished, but I can't even when manually deselecting "published".

Drupal version 6.30. Fresh install. No whacky modules added.


texts: How can I login to my local drupal site 8.3.1 which was under maintence mode

texts: I just logout to see what will the home page look like. Now, I can't login into my local site.


texts:
I'm trying to create a popup notification on a route that shows the current cart value (subtotal) and notifies users to add $X.XX to receive free shipping.

I have extended a route to add new functionality but I'm unsure whether a hook or service would be best/appropriate.  I can't seem to find any documentation on cart value--I can see some functions for retrieving quantity of items and seemingly could calculate the price by retrieving the prices for each individual item but research isn't bringing up much.

I see information regarding Order Totals but one would seemingly have to finish the order process in order to retrieve that data.  I'm trying to grab cart value when a user goes to the /cart page.

I'm not asking for anything specific, just a pointer in the right direction.  Thank you.


texts:
I need some help with the taxonomy view.
How can I create many views for many terms ?
I want that many terms from different taxonomies terms point to different views or at least to different structures of the same view.
The problem is that drupal translate each link of all taxonomy term to the model taxonomy/term/% that makes that all taxonomy term point to the same view. and I want that each taxonomy term point to a different views.
I hope i expressed myself well !
Thank you very much!


texts: How do I add a menu item to the main navigation from a custom module in Drupal 8?

texts:
For my custom Drupal 8 module I want to add a link to the default main navigation menu of the site.

What parent ID do I have to give to insert my menu item into the main menu?

I currently have the following config in my_module.links.menu.yml:

entity.sss_topic.collection:
  title: 'Topic: Listing'
  route_name: entity.sss_topic.collection
  description: 'List Topic'
  parent: main

But that only adds a menu item into the "Tools" menu (the same effect as specifying no parent whatsoever).
However, parent: system.admin_structure does work correctly.

Do I have the wrong parent ID? Or maybe a bug?


texts: How can I change the display of government field in drupal commerce shipping address?

texts:
I need to change the display of the order/shipping address of drupal commerce to render the city in a select list instead of writing the city, I need to upload in the database the list of the cites relevant to the governments of Egypt.

Are there a module may help to achieve this? as I don't have a PHP developing experience.


texts:
I know, wrap your head around it! Heh. I am having an issue in IE9 when trying to submit a form button via Drupal 7 & Drupal Commerce.

Example: http://www.um-me.com/frame.html

I have the following Drupal form source code

<form class="commerce-add-to-cart commerce-cart-add-to-cart-form-8" enctype="multipart/form-data" action="/band/4/band-ninjas?fb=TRUE" method="post" id="commerce-cart-add-to-cart-form-8" accept-charset="UTF-8">

        <input type="hidden" name="product_id" value="8" />
        <input type="hidden" name="form_build_id" value="form-oJeTHBh1Qn5myvhzMEgLvG5B6zY0vN7So0iQ4M3bazY" />
        <input type="hidden" name="form_token" value="psKsdV22J3T3ybyHXCJifIVlmdjhmlIM8u8iun9WLvQ" />
        <input type="hidden" name="form_id" value="commerce_cart_add_to_cart_form_8" />

        <input type="hidden" name="quantity" value="1" />
        <input type="submit" id="edit-submit" name="op" value="Add to cart" class="form-submit" />

</form>

This is taken directly from Drupal. I am using it as a method to test. The actual live (also non working in IE9 version) of this is here: https://www.facebook.com/dijitl/app_187714134672420 (click the buy button)

This works in all of the other major browsers, but for some reason it does not work in IE. I have tried a "normal" non-drupal form within an iFrame and it worked fine in IE, which leads me to believe that Drupal needs something from the form that IE is not giving it.


texts: Unable to access translated node content

texts:
After performing a Drupal core update on my site today I've found that I can no longer access translated content. When I try to view or edit the translation, I only see the default language content.

I created a short GIF you can view here:

via GIPHY

As you can see, I'm editing the node for Canada and the US translation is showing instead. Translations were working fine with Drupal 8.6.2 but began to do this in 8.6.3. I have now done the following with no success:

Updated to the latest Drupal core 8.7.2
Updated all installed modules
Created a new Drupal site with 8.6.3 and 8.7.2, but this issue does not exist
Disabled Workbench moderation for a given content type, but that doesn't fix the issue

I'm really not sure where and or how to troubleshoot this issue. Where would you start?

I'm thinking I could start by uninstalling modules to see which is possibly causing the issues. I'm not sure if that is the right approach given that this issue began when I updated the Drupal core, not the modules.

Thank you for any feedback!


texts: How can I access the virtual machine filesystem from within Windows?

texts:
I've recently tried to get used with Oracle VirtualBox Manager and the QuickStart 1.0 VM machine: http://drupal.org/project/quickstart. I've installed it on

Everything looks fine and great but the only big issue is I cannot access the files from outside (Windows 7). I need to have a way to control the Drupal installs (backup them, commit/checkout with the linux server etc). How do I?

I heard there is a solution to install samba but this only works if you have a real linux installation on your computer.


texts: How to disable/hide /unset a block programatically?

texts: I have a page whose content is visible only in certain provinces. When people visit this page from a different province other than the one it is set for,it should be giving a message saying "the content is not available in the region" by overwriting the node's body in the same page, by using hook_node_view. But I have blocks enabled in the content area on this page. is there a way to disable the contents of the block? i tried hook__block_view and hook__block_view_alter but it did not work. Can someone help me?


texts: Why don't external JS files load on mobile site built with jquerymobile/JQM?

texts:
I'm developing a site that uses the Mobile Tools module to switch between a "desktop" and "mobile" theme. The mobile theme is implemented using the jquerymobile module and s sub-theme of JQM theme.

Unfortunately, the mobile theme will not load any external javascript files that are inserted by other modules (Google Analytics, Facebook Connect). These work fine on the "desktop" theme, but just don't load at all on the mobile theme, so I'm not getting any Google Analytics stats for views on that theme, nor can I implement Facebook Connect login.

According to the jquerymobile docs, there are some issues with the loading of scripts because of the AJAX page loading feature in jquerymobile, but I've turned that off, so every page is its own complete page request.

I am using version 1.0b2 of the jquerymobile library, and gently hacked the jQuery Update module to provide version 1.6.2 of jQuery, since that is a requirement for that version of jquerymobile.


texts: How to translate a custom module template file?

texts:
How do I translate a custom module theme file?

function bonds_graph_theme($existing, $type, $theme, $path)
{
    $items = array();

    $items[BONDS_GRAPH_MODULE_NAME] = array(
   'arguments' => array(),
   'file' => 'inc/theme.inc',
   'template' => 'tpl/bonds_graph',
 );

return $items;
}

The theme file has a translatable string

<?php print date('Y') . ' ' . t('Issuance'); ?>

The language file zh-hans.po has the translation

#: tpl/bonds_graph.tpl.php:7
msgid "Issuance"
msgstr "发行"

The site language is set. How do I get the string translated?


texts:
In Drupal 7, if I wanted to get the node id of the currently displayed node (e.g. node/145) I could get it with the arg() function. In this case, arg(1) would return 145.

How can I achieve the same in Drupal 8?


texts: I create a menu "XXXX" move "Create content" and all of it's children to "XXXX" then remove XXXX menu. now I miss "Create content", how can I restore them?


texts:
I'm attempting my first Drupal site and would like to show a simple listing of the 5 most recent YouTube videos submitted (http://gdata.youtube.com/feeds/api/standardfeeds/most_recent?max-results=5).  I've been struggling with this for almost a week now and cannot get what I want.

I've tried Feeds and the YouTube parser and I've tried the Media Module as described here.  I can get the 5 most recent videos imported as separate nodes, but I want to just be able to list them, embedded, on the single page.

Any help would be greatly appreciated.  I'm new to Drupal and really looking for a walk-through at this point.  I'm using Drupal 7.19.

Thanks!


texts: Altering Webform email %value before sending email

texts:
I summon your wisdom on this day because I can't figure out how to alter submitted Webform values that are used in email templates.

Here's my situation:

I have a "contact us" form (set with Webform API) with first name, last name, email and message fields. Nothing spectacular. The submitted values are sent by email to the administrator.

In this webform setting > Email subject, I have this template:

[NAMEOFMYSITE | question from %value[first_name] %value[last_name]

Everything works fine. But my problem appears when the user forgets to put an uppercase in last name or first name value. It doesn't look professional in the email subject. And I want to force these two values with an uppercase as first letter to get something like:

NAMEOFMYSITE | question from John Doe

And never:

NAMEOFMYSITE | question from john doe

I tried to alter submitted values because I thought template's %value were based on it:

function pwe_webform_form_alter(&$form, &$form_state, $form_id) {
  [...]
  $form['#submit'][] = 'contactus_webform_submit'; // callback function on submit
}

function contactus_webform_submit($form, &$form_state) {
  $form_state['values']['submitted']['last_name'] = ucfirst($form_state['values']['submitted']['last_name']);
  $form_state['values']['submitted']['first_name'] = ucfirst($form_state['values']['submitted']['first_name']);
}

But even if I succeed to modify them, the %value in email doesn't change.

Of course, I dpm $form_state tree to see where the submitted values appear in it and where the template's %value could find its origin. It appears on several levels:

$form_state['input']['submitted']['last_name']
$form_state['values']['submitted'][2]
$form_state['values']['submitted_tree']['last_name']
$form_state['complete form']['submitted']['last_name']['#value']
$form_state['webform']['component_tree']['children'][2]['value'] (but always empty)

I altered every variable but the email value still the same. I'm about to ask myself if it is actually based on one of those variables... If not, on what is it based? And how can I alter it?

Please excuse the looooong post but I wanted it to be very clear. I hope you will help anyway :-(


texts: How to add link internal or external to an image in a view for a slideshow?

texts:
I need a slideshow and sometime the images need to have a link. This link might be external or internal and it is posted by users. I use rewrite results in my view. However, sometimes the picture does not have a link. So this does not work for me.

I am using Drupal 7, Views, link and slideshow, picture module. My content type has the following fields:

field_slideshow_image
field_link_in_picture
text_slideshow

I try used another modules but I need to use the picture module to make my pictures responsiveness.  Other modules require that use the Formatter in views and picture module uses its own format.


texts: Unable to edit custom block without administrator permissions

texts:
I created a content type "landingpage" and a user role "editor". I enabled layout builder for this content type and enabled the option to overwrite the the layout for individual pages.
As Admin I can easily add custom blocks to the layout and afterwards I*m able to edit those blocks oder delete them.
As Editor, however, though I a am able to add custom blocks, I neither can edit my own blocks nor am I able to remove them.
I granted the editor role following permissions:

Admin blocks
Custom block: Manage display
Content - Landing page: Configure layout overrides for content that the user can edit.
Create and edit custom blocks
Manage Layout Builder Modal

Im using Drupal 8.9.14
Has anyone an idea to solve my problem?


texts: Restrict User Role from Unpublishing Content

texts:
I'm attempting to restrict a certain role from being able to unpublish content of a certain content type but I can't get it to work correctly. They need to be able to publish but not unpublish this content.

If "Administer Content" is checked they seem to be given permission to publish/unpublish any content types. If it's unchecked and I attempt to defer to the individual publish/unpublish permissions for that content type they lose the option to use the "Publish" checkbox when editing nodes of that type.

Am I missing something or doing something wrong?


texts:
I don't find a way to hide the quick tab title. Is there a hard way if not straight forward? Because I just cant use the title which doesn't make sense in my context/content.

My quick tab title is "Property Tabs". There are 3 tabs under it. Below SS is showing only one tab because I have checked "Hide empty tabs". My tabs are all blocks

3D Gallery
Image Gallery
Video Gallery

I don't want to show the "Property Tabs" (highlighted in SS). I have tried to give title as "" but its still showing the title literally "". Its not accepting "empty string" or "space"


texts:
I am working on a module where I need to display content in a table. Though I have created a simple table already, I need to know how to use theme(), as the function cannot be called directly.

Basically, What is the equivalent of the following line, which was perfectly fine in Drupal 7?

return theme(table,array(header => '$header', rows => '$rows'));


texts:
I have been trying to research this issue for about a week now but not having much luck as some of the similar postings do not make too much sense to me. Either way, I appreciate any help and guidance on this!

I have a custom module that utilizes the CKeditor and submits HTML tags to the appropriate column in the database table. Example tags:

I am using the views module to display results but instead of the HTML tags rendering, I am seeing:

This is a test:

test 1

test 2

test 3

When I inspect the browser I actually see:

&lt;p&gt;This is a test:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;test 1&lt;/li&gt;
    &lt;li&gt;test 2&lt;/li&gt;
    &lt;li&gt;test 3&lt;/li&gt;
&lt;/ul&gt;

What I want to see is:

This is a test:  test 1 test 2 test 3


texts: How to set up options for a mini-panel (getting 'undefined index' error)?

texts:
This might be a tough question, sorry, but I am really struggling here.

The scenario is this: There is a series of similar mini-panels on my site that are being used as menus. I want to add an optional attribute (autoheight) to the html of these menus, operated by a check box via the back end.

Here's what I have done so far by Googling and blundering my way through:

In the .module file I added:

function foundie_add_menu_settings(&$form, &$form_state) {
//OTHER SETTINGS
$form['foundie']['autoheight'] = array(
     '#type' => 'checkbox',
     '#title' => t('Autoheight'),
     '#description' => t('Make drilldown menus adjust height automatically'),
     '#default_value' => $form_values['autoheight'],
   );
}

This seems to work fine - I can see the checkbox.

In the theme's template.php file, in the preprocess function for the menu element I have:

function foundation_preprocess_menu_block_wrapper(&$vars) {
  $settings = variable_get('foundie_block_menu_block_' . $vars['config']['delta']);
  if (empty($settings)) {
    if (!isset($vars['config']['style'])) {
      return;
    }
    $settings = $vars['config'];
  }

  $breakpoints = foundie_get_theme_setting('foundie_breakpoints', array(
    'small' => 'Small',
    'medium' => 'Medium',
    'large' => 'Large',
  ));
  $vars['content']['#tooltip'] = $settings['tooltip'];
  $vars['content']['#autoheight'] = $settings['autoheight']; //<--I ADDED THIS
  $vars['content']['#hover'] = $settings['hover'];
  $vars['content']['#style'] = $settings['style'];
  dpm($vars);
  foreach ($breakpoints as $breakpoint => $dimension) {
    $vars['content']['#' . $breakpoint] = $settings[$breakpoint];
  }

To me, that looks fine. It should be adding the value from the .module checkbox to the $vars which will then be processed and placed in the element (as far as I can tell).

I am getting the error:

  Notice: Undefined index: autoheight in
  fcl_foundation_preprocess_menu_block_wrapper() (line 410 of
  /var/docroot/web/docroot/sites/all/themes/custom/fcl_foundation/template.php).

Obviously, I am missing something here though. Would anyone be able to point me in the right direction? I think I am missing a step or something.

Any help is appreciated.


texts:
Does Drupal have any tool to generate URL from hook_menu() link pattern? Something like this:

some_function('node/%/edit/something/%', array(1, 19))

that will generate this URL: http://maindomain.com/node/1/edit/something/19.


texts: How to save custom fields when using hook_form_FORM_ID_alter?

texts:
I am implementing hook_form_FORM_ID_alter(). I have managed to setup for, and be able to collect custom values from the fields. When I submit the form, the node is created without my custom fields (i.e field_1 an field_2).

function mymodule_form_AYG_node_form_alter(&$form, &$form_state, $form_id){
  $options_first = _mymodule_get_first_dropdown_options();

  $selected = isset($form_state['values']['field_1']) ? $form_state['values']['field_1'] : key($options_first);

  $form['field_1'] = array(
    '#weight'=> -15,
    '#type' => 'select',
    '#title' => 'field 1',
    '#options' => $options_first,
    '#default_value' => $selected,
    '#ajax' => array(
      'callback' => 'mymodule_dependent_dropdown_callback',
      // 'wrapper' => 'dropdown-second-replace',
    ),
  );

   $form['field_2'] = array(
    '#weight'=> -14,
    '#type' => 'select',
    '#title' => 'field:',

    '#prefix' => '
',
    '#suffix' => '
',

    '#options' => _mymodule_get_second_dropdown_options($selected),
    '#default_value' => isset($form_state['values']['field_2']) ? $form_state['values']['field_2'] : '',
  );

  $form['#validate'][] = 'mymodule_form_validate';
  $form['#submit'][] = 'mymodule_form_submit';

  return $form;
}

function mymodule_form_submit(&$form, $form_state) {
  // I can see values for the custom fields here.
  // How do I store them in the node?
  dpm($form_state);
}

I have installed the Entity API module, and tried the proposed solution. It gives me an error.

function mymodule_form_submit(&$form, $form_state) {
  $node = $form_state['node'];
  $node = node_load(arg(1));

  krumo($node);  // Getting FALSE here

  $obj = entity_metadata_wrapper('node', $node);
  $obj->field_1 = $form_state['values']['field_1'];
  $obj->field_2 = $form_state['values']['field_2'];
  $obj->save();
}

This is the error:

  EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 735 of E:\wamp\www\Classified\sites\all\modules\entity\includes\entity.wrapper.inc).
  The website encountered an unexpected error. Please try again later.


texts: Drupal 7 to 8 migration The "taxonomy_term_reference_plain" plugin does not exist

texts:
When running the d7_field_formatter_settings.yml (in core/modules/field/migrations/) migration I get the following error.

The "taxonomy_term_reference_plain" plugin does not exist

Has the taxonomy_term_reference_plain formatter been removed from Drupal 8?
If so what is the equivalent in drupal 8 and how can I map taxonomy_term_reference_plain into its drupal 8 equivalent during migration


texts: When using "Filter by an entity reference view," can I enable the "Create referenced entities if they don't already exist" option?

texts:
I have an entity reference field for taxonomy terms on a node.
The Default Reference method has the option Create referenced entities if they don't already exist.
This lets me add new terms via the entity reference field when creating a node.
I want to restrict the terms that can be selected, so I set the Reference method to Views: Filter by an entity reference view.
However, when filtering by an entity reference view, I can't add new terms via the entity reference field when creating a node.
Is there a way to use Views: Filter by an entity reference view and still let users create new terms?
Additional info: My custom views filter simply filters the terms to those that were created by the logged-in user, so in this case, there is no possibility that allowing users to create terms would make it impossible for them to use the created terms on the node.


texts: Limiting allowed HTML tags in comments only

texts:
I can't figure out how I can limit my text format or HTML codes for the comment sections on a node. If I edit the input formats with user roles, it edits the entire thing, including the node body and other fields.

For example, I want to have filtered text on the body field of a node, but only plain text (or other custom text format) in the comments section.

The problem I'm running into is that I have added <embed>, <param>, <iframe>, <object> into the allowed HTML tags field in my filtered text format settings, but this also allows users to post Youtube videos into the comments section, and I don't want that.

How can I do this?


texts: How to create an "All" link in a taxonomy menu (block)?

texts:
I have a taxonomy vocabulary and terms as follow:

Food:
  -Meat
  -Veggies
  -Fruit
  -Dairy

I want to create a menu of taxonomy terms that look like this:

-All
-Meat
-Veggies
-Fruit
-Dairy

... when you are on the "Food" page.

I have tried the Taxonomy Menu and Taxonomy Menu Block modules, but none give me the option to have an "All" link. That's a bit daft innit?

How can you show the user posts/nodes of all terms?

Any other solutions?


texts:
I have installed the Calendar module and would like to translate a few fields:

At the above screenshot, I'm looking for the day strings ("Sun", "Mon", "Tue", Wed",...). I've been searching everywhere, but can't find where they are located.

Where can I find these strings so I can translate them in the language I prefer?


texts: How can I execute jQuery within a *Basic page* content type node?

texts:
I would like to run some jquery within a Basic page content type node and the only place that I can place this code is within the Body section when within the Edit Basic page.
After placing the following at the bottom of the Body section like the below:
jQuery(window).unload( function () { alert("Bye now!"); } );

It errors off so that it appears that it does not have jQuery included within this content type.
I tried putting a link to Jquery before calling jQuery but the link to it also errors off.
How can I execute jQuery within a Basic page content type node?


texts: How to filter a view by the value of a global variable (as with the variable module)?

texts: I have a global variable, which is the id of a node representing a current organic group that changes every year. I'd like to have a rules view that filters on members of that group. I've added the right relationships and a filter on the group id of the membership entity. But I can't enter a token or a variable value in the filter dialog. What can I do?


texts:
I am trying to use panel in Drupal 8 node view template. I have enable Node view panel and added a new variant for Basic page view. But I couldn't mention in panel page to take the title as current node title. Where I can mention it in panel configuration?

Drupal 8

Even I have created the panel variant in Drupal 7. Here title is taking by default node title.

Drupal 7


texts: Custom submit handler on node form not picked up

texts:
I am altering a node form with hook_form_alter and adding a couple of submit handlers. When the form gets submitted they get picked up using:

foreach (array_keys($form['actions']) as $action) {
  if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
    array_unshift($form['actions'][$action]['#submit'], 'submit_handler_a');
    $form['actions'][$action]['#submit'][] = 'submit_handler_b';
  }
}

Problem is, if the form contains a field that can store multiple values, as soon as I click on the 'Add more' button for that field and a new value for it, when submitting the form my handlers are not being picked up.

What am I doing wrong?


texts:
I am trying to upgrade from Drupal 6.28 to Drupal 7.22. By following the steps that were available on Drupal community doc, I succeeded in upgrading it to Drupal 7 successfully. I upgraded core, migrated CCK fields as well, but there are issues with the Views module: Various fields are not working. It is showing an error for a missing or broken handler.

The issue is that Drupal 6 had an embedded video field which was not included in Drupal 7. In Drupal 6, the widget type was embedded video, while in Drupal 7 the widget that we get by embedded media selector is media file selector.

How can I resolve this issue?


texts:
In Views showing as a table, I have 3 fields, field_checkbox1, field_checkbox2 and field_checkbox3,  and values set to either Yes or No.
I need to add color to them, if the checkbox is set to Yes(on, checked, "1" or any other value that denotes a positive value that Drupal recognizes) the border of its  should be set to "2px solid #00ff00".
*****************************EDIT******************************

Which css file (there are 6) governs class="views-field views-field-field-checkbox1 green"? How Macro do I have to get?


texts: 2 separate Profile2 Views (one faculty, one staff)

texts:
I've been able to create a view with the profile2 module (with custom forms)that renders all users on a view. How can I create a separate category of users, say 'faculty' and 'students' and have a view for each? So the faculty view would only show users labeled as faculty.

Thanks!


texts: Can we change the schema in services module?

texts:
I am new to Drupal services; I have the below XML format, in which I need to expose nodes as services.

Can I do this using the Services module?

    <?xml version="1.0" encoding="UTF-8"?>
<ngd:mediafile xmlns:ngd="http://www.xyzy.com/ngdine"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.xyzy.com/ngdine mediafile.xsd">
  <ngd:description>
    <![CDATA[This is the description]]>
  </ngd:description>
  <ngd:mediatype id="1"/>
  <ngd:internal>Aalborg city.JPG</ngd:internal>
</ngd:mediafile>

Can I change the schema?


texts:
function welcome_menu() {
  $item=array();
  $item['welcome'] = array(
    'title' => 'welcome',
    'access callback' => 'welcome_init',
    'page callback' => 'welcome_test',
    'type' => MENU_CALLBACK,
  );

  return $item;
}

/*
 * Implements hook_init().
 */
function welcome_init() {
  if (empty($GLOBALS['user']->uid)&& arg(0)!='welcome') {
    drupal_goto('welcome');
  }
}

function welcome_test() {
  $output = 'welcome';
  return $output;
}

I want to auto redirect the anonymous users to the login page, and avoid that an authenticated user can see this page. how I use user_login_block() as page callback?


texts: Why does CACHE_TEMPORARY have the same value as DRUPAL_NO_CACHE

texts:
I'm trying to change the cache of my block (hook_block_info_alter) but it seems if I change from CACHE_TEMPORARY to DRUPAL_NO_CACHE, it doesn't make a difference.
Drupal declared them like this:

define('CACHE_TEMPORARY', -1);
define('DRUPAL_NO_CACHE', -1);

Why do we have the same value if they're meant to be different?
How can I change the value in hook_block_info_alter?


texts:
I have been creating new view modes with the entity view mode module as well as created template files for the new view modes.

At this point I would like to know how I tell a given page or url (ie. front page) which view mode of a particular content type to use


texts:
I use Zeropoint theme and the drop-down menu in this theme.
When I hover the mouse over a menu, and the menu is expanded, my submenu is placed under the slideshow and is not show completely.

Do you have any suggestion on how to solve it?


texts:
I have a Drupal schema where I want a view to display node 'item' results based on fields from an associated 'catalogue' node. Each associated 'catalogue' has a 'catalogue_ranking' node which is used to order 'item' results.  So the join I am looking for is:

items <== LEFT JOIN catalogue <== LEFT JOIN catalogue_ranking

I can manually construct the SQL I need to produce the results as follows:

SELECT node.nid, substring(node.title, 1, 20) AS title, field_data_field_catalogue.field_catalogue_nid,
       node_catalogue.nid AS cat_nid, substring(node_catalogue.title, 1, 20) AS cat_title,
       field_data_field_ref_catalogue.field_ref_catalogue_nid, node_cat_ranking.nid AS rank_nid, field_data_field_priority.field_priority_value
  FROM node node LEFT JOIN field_data_field_catalogue field_data_field_catalogue ON node.nid = field_data_field_catalogue.entity_id
                 LEFT JOIN node node_catalogue ON node_catalogue.nid = field_data_field_catalogue.field_catalogue_nid
                 LEFT JOIN field_data_field_ref_catalogue field_data_field_ref_catalogue ON node_catalogue.nid = field_data_field_ref_catalogue.field_ref_catalogue_nid
                 LEFT JOIN node node_cat_ranking ON node_cat_ranking.nid=field_data_field_ref_catalogue.entity_id
                 LEFT JOIN field_data_field_priority field_data_field_priority ON node_cat_ranking.nid = field_data_field_priority.entity_id
  WHERE LENGTH(node.title) > 1 ORDER BY IFNULL(field_data_field_priority.field_priority_value, 0) DESC LIMIT 5;

However, I've been going bananas trying to figure out the exact forward or reverse relationships needed to produce the same results using the Drupal view UI. The "Priority" field remains stubbornly blank no matter what combinations I try! What am I doing wrong?


texts: Add description to files uploaded by the Media file selector widget

texts:
I am using D7 with media module. I have a field for (multiple) files.

Instead of the built in "file" widget for the file field, I am using the "Media file selector" widget.

In drupal core's "file" widget, I am able to select the "Enable Description field" option to label the files. I am unable to find such an option with the "media file selector"

There is a whole section to add files with many fields. But I am looking for a field with some sort of description or title option. I will use it as the link text, instead of the file name.

Is there an option somewhere that I've been missing?

Thanks.


texts: How to change the icon classes using mmenu

texts:
I'm new to the drupal community, so I'm sorry if I make any mistakes in posting this question. I want to change the menu-item icons for the Mobile sliding menu module. I realize that my question is similar to this one, but I believe I'm having a slightly different issue. The original post was having issues with having any icons showing up.. my icons showed up right away, but it's the same icomoon icon over and over again (icon-list2). The icons are defined in the css, but I can't figure out how to actually apply the class itself to the mmenu module.

I have set up the icomoon library and changed the CSS file according to the documentation. I have not changed the original mmenu module, I have only changed aesthetics.

Each menu link has a  inside. If I change this class through the inspector, the icon changes as expected (for example, .icon-office), however, I can't seem to find an easy way to change it through drupal (see image below).

I can change the class name using the inspector tool in order to change the the icon. My question is how to change the different in the code or module (see below)

The only part of the mmenu module that I can find that refers to the "icon-list2" class is in the mmenu.module file in drupal>sites>all>modules>mmenu (see image below)

I'm not sure if there is something I need to modify in the mmenu.module, but I have a hard time seeing what I should change and I've always thought that it is bad practice to hack the main module.

Thank you so much in advanced.


texts: Upon clicking save, how do I stop the node from inserting?

texts:
Upon saving a new node, I need to check against a function, if its field value is available. If not, I need to prevent the node from saving.

function mymodule_node_insert($node) {
    $uniqueName = $node->field_name['und'][0['value'];
    if (checkIfAvailable($uniqueName) == FALSE) { die; }
}

function checkIfAvailable($uniqueName) {
    return FALSE;
}


texts: How to remove edit tab after create commerce order

texts: How to remove edit tab after create order for Authenticated User.


texts:
I'm trying to integrate Stripe’s Checkout and PHP into a simple module and I've got the following:

Stripe::setApiKey($stripe['secret_key']);

if (!empty($form_state['input'])) {
  $input = $form_state['input'];
  // Create a Customer
  $customer = Stripe_Customer::create(array(
    "card" => $input['stripeToken'],
    "email" => $input['stripeEmail'],
  ));

  // Charge the Customer instead of the card
  $charge = Stripe_Charge::create(array(
    "amount" => 4900,
    "currency" => "GBP",
    "customer" => $customer->id,
  ));
}
else {
  $data = array(
    "data-key" => $stripe['publishable_key'],
    "data-name" => variable_get("site_name", ""),
    "data-amount" => 4900,
    "data-currency" => "GBP",
  );

  $form['stripe'] = array(
    '#markup' => '<script src="https://checkout.stripe.com/checkout.js" class="stripe-button" ' . join(' ', array_map(function($sKey) use ($data) {
      if (is_bool($data[$sKey])) {
        return $data[$sKey] ? $sKey : '';
      }
      return $sKey . '="' . $data[$sKey] . '"';
    }, array_keys($data))) . '></script>'
  );
}

Everything is working great so far apart from when I call $charge = Stripe_Charge::create I get an error returned Stripe_InvalidRequestError: You cannot use a Stripe token more than once but I don't understand how my code would be using the token more than once.

Although I get this error, in my dashboard at Stripe the payment is successfully processed, I'm using the Stripe API Client Library for PHP


texts:
We use Drupal as the basis for a student information website. We have 3 intakes of students a year and I would like to be able to allocate students various rights based on roles, primarily if they are

a current student,
an applying student,
or an alumni.

But I would also like to be able to identify them by what class they did.

Should I create a new role for each new intake?
Should I use groups?
Is there an alternative method I should use?


texts:
As I understand it commerce gets the users highest numbered order that is not yet completed (on the customers end) and uses that when a user adds an item to their cart or views their cart however I created a module that will allow a single user to create many carts (lets call these quotes) for their customers and i need a way for them to be able to go back and edit a previous quote or complete checkout on a previous quote right now i have a list of quotes in a view (any order that has not passed the checkout review page) and I want to add a column containing a link or button that will allow them to load that order number as the current cart I tried using a custom module function with a call to

commerce_cart_order_load(1);

(from a menu link) which is a previous order on my account however that appears to do nothing

Can anyone explain what I'm doing wrong/ what I need to do to make this work?

I would be perfectly happy doing this with views php if there is a function to set the users cart order that I'm missing, or by storing an OrderID hidden on the users profile

Thank You


texts: Not able to add fields to my content type in Drupal 6

texts:
In my localhost drupal site I have created a content type "Scholarship". Now I need to add few more fields (checkboxes, radio etc) to it.

The problem is, I cannot see "Add new fields" option anywhere on the page. When I click the "Manage Fields" options I am redirected to the "content/node-type/scholarship/fields" and there is no option for adding new fields.

It was working initially, but after a while it stopped. I disabled Panels and few other modules that I think might have caused the problem. But it still does not show

Any idea on what is causing this problem?

Thanks.


texts: How to create add and edit pages for content types beside to Administration

texts:
In my drupal installation (Drupal 7) I have various users.
What I want to do is, I want to enable somehow my users to be able to create content their own, without using the administration page.

Lets say, user clicks on a link to create an article or blog without going to administration page. The linked page contains a form for the article/blog and the user submits that form. So has been the content created.

What is the proper way to do it?
Self development of forms?
How is the URL then built?

I have found something like that
how-to-create-different-panels-for-add-and-edit-node
but here the module "Pages" is probably used.

It would surprise me that something like that does not exist.


texts:
For a Birthday field using the Date module, Views sorts it by year.  This puts the dates in basically random order once you format it to display only the month and the day.  Could it sort by day and month only?

Extra bonus question: Could Views sort the Birthdays in context of the current day so the upcoming Birthdays float to the top?


texts: Displaying multiple File entity types in a view, when they have different fields to display

texts:
Working with the Media module, I want audio and video files to show (user uploaded/selected) preview images when displayed in areas throughout the site (instead of the default soundwave and film clip image.) So, I added fields to those files type entities, but since Image can be it’s own preview, I didn’t add that field (since it would seem odd to make the user upload/choose the image again.) This has become a GIANT pain when trying to figure out how to show all the file types together in a single view. (I want it to show field_image for audio and video, but the file for images.)

Does that sound undoable? Nothing I've been able to try with views and relationships gets me what I need. I tried customizing the preview display mode for each, then display the "rendered entity" (which got me what I needed for displaying the images), but left me with other issues, since I was displaying field_image fields for some, but file fields for others.

Slight Update: I tried adding the field_image field to the image file type, but that seems to cause some kind of infinite loop/server error when viewing/editing that file anywhere.