texts: How to get the URL for an image thumbnail

texts:
I'm using a view template to override how a field is displayed.

The field happens to be an attached image to the node.

I notice in the view it's configured to display the thumbnail - when overriding, how do I get the thumbnail?

(I'm using entity_metadata_wrapper )

EDIT

So based on the suggetions below I need to use image_style_url - how do I get the path to pass to it?

ie, how do I complete this code

$node = node_load($row->{$field->field_alias});
$wrapper = entity_metadata_wrapper('node', $survey_node);

// Field is called field_image

$path = ???

$thumbnail_url = image_style_url('thumbnail', $path)

print "<img src='" & $thumbnail_url & "'>"


texts: views_row_selector module - capturing a form submission

texts:
I am using the views_row_selector module to add checkboxes to a table created in Views

The hook_menu $item looks like this

$items['admin/structure/account'] = array(
    'title' => 'Accounts',
    'description' => 'Names and addresses',
    'page callback' => 'views_embed_view',
    'page arguments' => array('accounts_view'),
    'access arguments' => array('administer booking'),
);

Everything works perfectly, but how do I capture the form submission?


texts: Issue form submit after ajax_command_replace

texts:
I have an issue with sending a form.

I have a form with some containers and 2 selects fields. The selects fields call the same callback who use "ajax_command_replace" to add some others fields and a submit button.

When I press the submit button, the page is refresh but my submit function is not called.

I need to do something in particular to call a function with "ajax_command_replace" ?

Here is my code for the submit button :

$addForm['button']['btn_submit'] = array(
    '#type' => 'submit',
    //'#submit' => array('f_form_submit'), not working too
    '#value' => t('Validate'),
);

$commands[] = ajax_command_replace("#z_btn",drupal_render($addForm));

function f_form_submit($form, &$form_state){
    dpm($form_state);
}

Someone have an idea why my function is never called ?


texts:
I create a cordova app, and trying to register new user from my app using drupa 7, drupal 7 service 3 and angularjs 1.

I send post request with below data and user created successfully.

    $http({
        headers: {
            'X-CSRF-TOKEN': $rootScope.globals.auth.token
        },
        method: "POST",
        url: registerUrl,
        data: {
            name: data.name,
            pass: data.password,
            mail: data.email,
            "field_ac_mobile_number": {"und": [{"value": data.mobile}]}
        }
    }).success(function(userData) {
    }).error(function(data, status, headers, config) {
    });

But my problem is- after create user, password is empty.

How to solve it?

UPDATED QUESTION:

I altered registration form by three step registration form for verify customize 6 digit character instead url for email verification.

All works fine. But when I send final request with all params, user created without password.

But if I register from site, all values set well.

I don't understand, whats my problem...

UPDATED QUESTION 2nd:


texts: Please tell me how to remove the example shipping method. If I disable this module, my other shipping methods also don't work. There is no option to disable or delete this. The only option is 'Configure Component'. I have even tried imposing a condition on Example Shipping Method 'that it must show up only if the order is too big' but still doesn't work. All shipping methods get disabled even if I add a condition on 'Example Shipping Method. '


texts:
I am building a form that can either begin on the home page or at the '/apply' url. I used this tutorial to build the multi-step form. The form works great if I start from '/apply' and begin at the very beginning of the form process. The form does not work if I start from the home page and get redirected to the second step of the form, then try to submit that second step. This is the error message I receive when I try to submit that second page of the form when I started on the home page:

PHP Fatal error:  Cannot create references to/from string offsets nor overloaded objects in /Applications/MAMP/htdocs/drupal/includes/common.inc on line 6548
PHP Stack trace:
PHP   1. {main}() /Applications/MAMP/htdocs/drupal/index.php:0
PHP   2. menu_execute_active_handler() /Applications/MAMP/htdocs/drupal/index.php:21
PHP   3. call_user_func_array() /Applications/MAMP/htdocs/drupal/includes/menu.inc:517
PHP   4. drupal_get_form() /Applications/MAMP/htdocs/drupal/includes/menu.inc:517
PHP   5. drupal_build_form() /Applications/MAMP/htdocs/drupal/includes/form.inc:131
PHP   6. drupal_process_form() /Applications/MAMP/htdocs/drupal/includes/form.inc:374
PHP   7. form_builder() /Applications/MAMP/htdocs/drupal/includes/form.inc:842
PHP   8. form_builder() /Applications/MAMP/htdocs/drupal/includes/form.inc:1857
PHP   9. form_builder() /Applications/MAMP/htdocs/drupal/includes/form.inc:1857
PHP  10. form_builder() /Applications/MAMP/htdocs/drupal/includes/form.inc:1857
PHP  11. _form_builder_handle_input_element() /Applications/MAMP/htdocs/drupal/includes/form.inc:1795
PHP  12. drupal_array_set_nested_value() /Applications/MAMP/htdocs/drupal/includes/form.inc:2003

I am attempting to continue the multi-step form from the home page to the '/apply' page by saving the $form_state['storage'] array in the session, then reading it out of the session in the custom_module_primary_form function.

//Save form 'storage' in $_SESSION
function custom_module_first_form_submit($form, &$form_state) {
  ...
  if(request_path() == '') {
    $form_state['redirect'] = array('apply');
    $_SESSION['storage'] = $form_state['storage'];
    $form_state['rebuild'] = FALSE;
  }
}

This is the modified custom_module_primary_form function from the tutorial.

//Read form 'storage' out of $_SESSION
function custom_module_primary_form($form, &$form_state) {
  // Check to see if anything has been stored.
  if ($form_state['rebuild']) {
    $form_state['input'] = array();
  }

  if (empty($form_state['storage'])) {
    if(isset($_SESSION['storage'])) {
      $form_state['submitted'] = TRUE;
      $form_state['rebuild'] = TRUE;
      $form_state['storage'] = $_SESSION['storage'];

      unset($_SESSION['storage']);
    } else {
      // No step has been set so start with the first.
      $form_state['storage'] = array(
        'step' => 'custom_module_first_form',
      );
    }
  }

  // Return the current form
  $function = $form_state['storage']['step'];
  $form = $function($form, $form_state);
  return $form;
}


texts: Is it possible to define a hook_preprocess function based on entity type such as profile2?

texts: I walked through the possible hooks by using function hook_preprocess(&$vars, $hook) and only entity was available to use. Is it possible to do something like hook_preprocess_profile2_entity(), or do I have to write an if condition to check the entity type in hook_preprocess_entity()?


texts: Is there a way for debugging "Access Denied" errors in Drupal 8? I'm having some routing/permission issues, and I would like to be able to debug why i'm getting "Access Denied".


texts:
I am trying to hide the fact that I have a Drupal site (as much as possible).

The idea is that if a would be hacker (I am not talking about some ninja that could break into the pentagon) looks at the site they would not be able to (easily) see it is a Drupal site.

Most of it is done - I just don't know how to delete some cookies set by modules.  In specific I want to do this for anonymous traffic (clearly someone that is logged in already knows they are on a Drupal site).  The cookies that I want to delete would not affect the site - it is related to two admin modules.

I tried a couple of hooks - the last one was theme_html_head_alter - but nothing works.  This is the code I need to insert somewhere - just not sure where?

if (!user_is_logged_in()) {
   user_cookie_delete('DrupalModuleFilter');
   user_cookie_delete('Drupal_tableDrag_showWeight');
}


texts:
We have a website which will host lots of species information. A resource is entering the data on behalf of another person. I would like to change the author information of the nodes once the data entry is completed.

Is it possible to replace all instances of the author ID of 'Person A' with 'Person B'? I assume we need to write some database query and run it in the phpMyAdmin. What query it would be? Also, is there any other efficient way?

Thanks


texts:
I have the following issue using a Webform inside a panels-page. I have the following configuration:

I have a pretty simple contact form (to start with) build with webforms. In this form is a field emailaddress which is filled with the content of a field in the node on which the webform is placed using panels.

For using the nodefield as content in my form I am using the module webform_node_value. In this way I can use one form dynamically on (lets say) profile pages. These profile page are normal nodes and are not using the module profiles.

On the panel configuration I am using a context to concatenate the node-field.

This configuration is working without any problems.

The problem:
When I put a Visibility rule on the webform pane in the panel, which is checking if the context exists

(1) or a rule which checks if the field emailadres is not empty

(2), these rules are not working.
Using rule 1 (context) the form is always hidden... Using rule 2 (empty field) the form is always visible...

I tried to use the form as a Webform or as a block. I am out of options...

Anybody any idea what's going wrong?


texts: Issues with Term Reference and Multilingual Taxonomy

texts:
The issue:

We have a multilingual Drupal 7 website which allows users access to a content type e.g. Blog - where they can use /node/add/blog and node/*/edit in their chosen language
A taxonomy has been created called category which has been set to 'Localize' under MULTILINGUAL OPTIONS >> Translation mode
Terms listed under category have been translated to FR, DE, NL etc.
On the content_type Blog - a term reference has been set up to reference the category taxonomy, with a select list widget being used.
When visiting e.g. www.multilingual-site.com/node/add/blog (default site language is EN) - the dropdown list shows all the terms.
When visiting e.g. www.multilingual-site.com/fr/node/add/blog or any other language e.g. /de/ or /nl/ etc the dropdown list is blank - the translated terms do not appear.

In an attempt to create the option list ourselves - using hook_form_alter() with taxonomy_get_tree($vid) as suggested here https://drupal.stackexchange.com/a/64666/5253 - when trying to dpm the output
the array is empty for every language other than the default EN.

Can anyone offer any direction? Thanks


texts:
I am using the Context module with the Block module disabled and noticed that blocks are not being stored in the cache. How do I get Context to cache blocks? Does it matter that much that blocks are not being cached?

The block module is turned off because I don't see why it is needed with the Context module enabled. The block module loads every block on every page load. So I imagine that it would be a boost to use Context without it. However, I'm curious if it would make sense to also have the Context module cache each block that it loads and check the cache first before it loads the block.


texts: Drush site-install fails with SQLSTATE[HY000] [2002]

texts:
I am having difficulties installing a d7 drupal site using Drush. The files downloaded fine using Drush. From within the renamed folder for the drush install I type

Pauls-iMac:drush-test Trotter$ drush site-install standard --db-url='mysql://superadmin:password@localhost/drush-test' --site-name=Example

I then get the message below. I can see from phpmyadmin that the database has been created ok, but has no tables in it.

You are about to CREATE  the 'drush-test' database. Do you want to continue? (y/n): y
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'superadmin'@'localhost' (using password: YES)
Starting Drupal installation. This takes a few seconds ...                   [ok]
WD php: Exception: Resolve all issues below to continue the installation. For[error]
help configuring your database server, see the installation handbook, or
contact your hosting provider.Failed to connect to your database server. The
server reports the following message: SQLSTATE[HY000] [2002] No such file or
directory.Is the database server running?Does the database exist, and have
you entered the correct database name?Have you entered the correct username
and password?Have you entered the correct database hostname? in
install_run_task() (line 414 of
/applications/xampp/xamppfiles/htdocs/drush-test/includes/install.core.inc).
WD php: Warning: Cannot modify header information - headers already sent by  [warning]
(output started at
/Users/Trotter/.composer/vendor/drush/drush/includes/output.inc:38) in
drupal_send_headers() (line 1233 of
/applications/xampp/xamppfiles/htdocs/drush-test/includes/bootstrap.inc).
Exception: Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.
Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2002] No such file or directory.

Is the database server running?

Does the database exist, and have you entered the correct database name?

Have you entered the correct username and password?

Have you entered the correct database hostname?

 in install_run_task() (line 414 of /applications/xampp/xamppfiles/htdocs/drush-test/includes/install.core.inc).
Drush command terminated abnormally due to an unrecoverable error.           [error]

I am confused as to why the message suggest that it cannot connect to the database, as it once managed to create the database. However when I deleted the db to try again, running the drush command again did not create the database again. The settings.php file has been created, but it doesn't have the mysql user name or password in it. The server (XAMPP) is still running. Any suggestions on what might be wrong?


texts: How to change the currency symbol according to language in site?

texts:
I have enabled i10n, i18n, entity translation, title and variable modules and built a multilingual commerce site with language English as default language and $USD as default currency. And French and Poland as additional languages.

But I am unable to change the currency symbol in other languages.

How to translate currency symbol also?


texts: How to point parent menu item to a link and sub menus too

texts: Hi I have a main menu named Home and there a sub menus in it. When I click any of the menu item of sub menu the content of the sub menu displayed. But After that I can not go to home by clicking home menu  as it contains sub menu and it does not point to home link hence its non clickable. My issue is that I want parent item to points to a link and sub menus too. Is it possible?. I am using bootstrap theme.


texts:
How can I configure programmatically a node object to open in a new tab? I thought maybe in the $node->path array?

I don't see where and how I can achieve this... There is nothing such as a rendered <a> on which I can add a target="_blank".

EDIT (more specific situation):

I've got a content type "news". It is possible to create news in 2 different ways:

An editor user creates manually through the admin interface (basic).
A custom module imports data from external RSS feeds everytime a piece of news is published in it.

I've got a view that display the list of news (just title, truncated text, date, logo...). When you click on a news' title, you access the full node view (normal). If it is an internal news (created manually), it displays normally. If it is an imported news, however, I redirect using drupal_goto to the source of the news (that I saved on node creation).

I want to make this very redirection in a new tab. It's quite complicated because it is originally an internal link (node/nid) that redirects to an external link (http://www.sourcesite.com).

I can make the difference between an imported/not imported node in the hook_preprocess_views_view. But I can't assign it something like a target _blank or whatever it exists to make this node opened in a new tab.


texts: Trying to access and print the values from the fields within Paragraph

texts:
I'm having trouble trying to access and print the values manually within the Paragraph. This is a snippet from the paragraph field template I have created. I wanted to access and print values manually instead of Drupal generating the markup using {{ slides.content }} so that I could customize the markup myself

{% for slides in items %}
    {{ slides.content['#options'].entity.field_label.value }}
{% endfor %}


texts: Preprocess function not running on theme

texts:
I am trying to query my database and return a number to store in a twig template called node--course.html.twig.

So I started by writing the function completionCheck() in class FormaRegis.php.

namespace Drupal\docebo_login;

use Drupal\docebo_login\FormaEntity;

class FormaRegis extends FormaEntity {

     public $ID;

  public function setID($ID) {
    $this->ID = $ID;
  }

  public function getID() {
    return $this->ID;
  }

    public function __construct() {
        parent::__construct();
    }

 public function rowBase() {

     if (parent::accessCheck()) {

        $sql = "SELECT * FROM learning_courseuser
                  WHERE idUser = " . $_SESSION['public_area_idst'] .
                 " AND idCourse = " . $this->ID. " ";
        return $sql;
       } else {

            return "";
       }

    }

    public function completionCheck() {
        $check = false;

         if (parent::accessCheck()) {
            $sql = "SELECT count(*) FROM learning_courseuser
                    WHERE DATE_FORMAT(CURDATE(),'%d/%m/%Y') = DATE_FORMAT(date_complete,'%d/%m/%Y')
                    AND idUser =  " . $_SESSION['public_area_idst'];

            return $sql;
          }
          else {
            return "";
          }

    }

}

and in a page called FormaEntity.php I wrote this function:

public function getCCresult() {
   if ($this->completionCheck() == "") {
      \Drupal\Core\Database\Database::setActiveConnection();
      return false;
   }

   $result = $this->connection->query($this->completionCheck())->fetch();
     \Drupal\Core\Database\Database::setActiveConnection();

   if ($result > 5 ) {
     $check = "fail";
   }
   else {
     $check = "pass";
   }

   return $check;
}

Then in FormaNotification.php I wrote function completionCheck().

namespace Drupal\docebo_login;

use Drupal\docebo_login\FormaEntity;

class FormaNotification extends FormaEntity {

    public function __construct() {
        parent::__construct();
    }

    public function getResult() {

         return parent::accessCheck();
    }

    public function completionCheck() {

         return parent::getCCresult();
    }

}

Then finally, in my MYTHEME.theme file I added the function mytheme_preprocess_node_course(&$variables).

function mytheme_preprocess_node_course (&$variables) {

  $noti = new FormaNotification();

  if ($noti->completionCheck() == "fail") {
    $variables['creditCheck'] = "yes";
  }
  else {
    $variables['creditCheck'] = "no";
  }

}

But when I visit the any page that uses the node--course.html.twig and use {{ kint(creditCheck) }}, it says that the variable is NULL. I am not sure what I am doing wrong. If anyone can point me in the right direction that would be great.


texts: How to let a user change their own username?

texts:
I can't seem to figure out how to let users change their own username. I'm running Aegir with about 10 Open Atrium sites. With permissions I've checked "change own username" for the master Aegir site, as well as the Open Atrium sites. For giggles, I enabled every role to "change own username"..

But when I try to change my username in OpenAtrium and click save, it confirms "changes have been saved", but the username doesn't actually change.  This has ballooned into a huge issue for us.  I'm hoping there is some obvious dumb thing I need to do.  Thoughts?


texts:
I worked briefly with Drupal 7 and I thought it was possible there but in Drupal 8 is it possible to have a view output an increasing numbered CSS classes for Views rows?

This is what I want.

I know I can add a CSS class to every row and give every row the same class.


texts: How to redirect to a specifi page of a view?

texts:
Here is the code of a custom form:

  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;
    $status = parent::save($form, $form_state);
    $values=$form_state->getValues();

some code here...

    switch ($status) {
      case SAVED_NEW:
        drupal_set_message($this->t('Le service « %label » a été ajouté.', [
          '%label' => $entity->label(),
        ]));
        break;

      default:
        drupal_set_message($this->t('Le service « %label » a été modifié.', [
          '%label' => $entity->label(),
        ]));
    }

    $form_state->setRedirect('view.services.page_2');
  }

The redirection doesn't work!
After validating my form, it goes to the first page of my view.
By the way, these two pages of the view are displayed as two tabs in a menu (the first being the default one)...


texts: How to get the Bootstrap 3 Datepicker to redirect to an URL when a date is picked?

texts:
I use the Drupal bridge module Bootstrap Date & Time picker with its associated JavaScript libraries.  I am trying to create a Drupal form where the user clicks on a particular month, and then the user is redirected to a page showing all the events happening that month.

This is how I build the form:

function rbg_date_picker($form, &$form_state) {
  $form['date'] = array(
    '#type' => 'date_text',
    '#bdtpicker' => TRUE,
    '#date_format' => 'Y-m',
    '#datepicker_chain' => array(
      'my_interval_end[date]' => 'next',
     ),
     '#datepicker_options' => array(
       'viewMode' => 'months',
     ),
  );
  return $form;
}

The form show up and when the user clicks on a month in the widget's grid, the date field gets filled in with the year and month.  So far, so good.

However, at this point, I want the JavaScript to redirect to an URL so that I can create an ordinary page with the relevant information.  For example, if the user picked August 2017, the Javacript should redirect to "http://example.org/2017-08".

Maybe there is already support for this functionality in the Drupal bridge module (and I haven't spotted it), or maybe I need to add a small JavaScript snipped to make this work (confession: I suck at JavaScript).  Any help will be appreciated.

(PS: I know that if I add a submit button to the form, I can pick up the year and month in the submit handler.  However, I think the UX would be better if the user can just click on the month, without having to explictly hit "Submit" afterwards.)


texts: How to reuse custom methods in a simpletest class?

texts:
I have created several test methods that I find useful in a lot of other situations.

All I need is to define an include file of higher visibility which contains an utility class which is autoloaded in every .test file throughout my Drupal modules.

Is this possible in the Simpletest framework?


texts:
We have a few scenarios on a project where we want results to be presented at the top of the of the page despite not having any keywords in the body copy related to the search keyword.

For instance, if someone on our site searches for "baseball," we'd like a few choice results about "football" to come up, even though the nodes are strictly about baseball.

Are there any modules that allow for this behavior in the search functionality of Drupal?


texts: Pre-populating a CCK field item with values from another field

texts:
I'm working on a project that has two compound field ("flexifield," or "multifield," if you use CCK3) sections that output content types "rooms" and "levels".

Level is defined first and has a title, a total area and an "above ground" binary value.

Room has a length, width and area, then a level defined by a select box — populated by the first set of fields via the following "allowed value" code:

$result = db_query('SELECT `vid`, `field_level_label_value` FROM `drupal_content_type_meas_areas`;');
while ($item = db_fetch_object($result)) {
$items[$item->vid] = $item->field_level_label_value;
}
return $items;

Alas, while the proper label is available when filling in the fields, when actually viewing the content type, the value of each "level" field is a numerical value, instead of the label defined by the level's "field_level_label" field.

How do I make this field save the field's string value instead of its (I'm guessing) vid?

Thanks!


texts: Execute user_save() after the form submission handler

texts:
In my implementation of hook_form_alter() I am using the following code; it executes mymodule_user_form_submit() before user_save().

array_unshift($form['#submit'], 'mymodule_user_form_submit');

user_save() is not executing after that.

What is the problem with this code?

I want to execute user_save() after mymodule_user_form_submit().

function mymodule_form_alter(&$form, &$form_state, $form_id) {

  if ($form_id == 'user_register_form') {
    drupal_set_message("Form ID is : " . $form_id);
    //$form['#submit'][] = 'custom_user_form_submit';
    array_unshift($form['#submit'], 'mymodule_user_register_submit');
  }

}

function mymodule_user_register_submit(&$form, &$form_state) {
//code goes here
$form_state['field_magentopass']['und'][0]['value'] = $form_state['values']['pass'];
}

if the code is wrong how can i assign the value to this variable $form_state['field_magentopass']['und'][0]['value']

or this entire method is wrong?
should i go for any other alternatives?


texts:
I have created a custom 404 page using hook_preprocess_page():

function THEME_preprocess_page(&$variables) {
  $header = drupal_get_http_header('status');
  if($header == '404 Not Found') {
    $variables['theme_hook_suggestions'][] = 'page__404';
  }
}

The contents of page--404.tpl.php is identical to the contents of page.tpl.php except that use a static text block instead of calling print render($page['content']);. When this page is displayed one of the menus disappears from the header. Everything else look just as it does when I'm on a ordinary page except for the menu.

Since I only wan't to change the actual message that is displayed when receiving a 404 page and still use the rest of the markup contained in page.tpl.php perhaps it would be a better idea to only alter the $page['content'] inside a hook or similar?

Would appreciate if anyone could help me figure out why the menu is vanishing or could give me a solution that only alters the $page['content'] in page.tpl.php in case of a 404.


texts: Search Taxonomy Term pages containing entity referenced nodes

texts:
So, I've got myself into a bit of a pickle here and was hoping that could point out a way through.

Drupal 7
Views
Display Suite
Entity Reference
Inline Entity Reference
Search API
Database Search

I have been building a sort of hybrid traditional multi-page and single-page site within the Bootstrap framework. In order to meet these requirements I have used an inline entity reference field to group multiple different nodes (each representing a Display Suite layout, such as 50%-50%, 33%-33%-33% etc) into a content type called 'Subject'. These 'Subjects' are to form each distinct row in a single-page style layout.

This has worked well, and I now need to compile these 'Subjects' into pages.

Because I want to avoid too much complexity in the workflow I decided against nesting these 'Subjects' into yet another content type called 'Page' using more entity references. Instead I went for a taxonomy vocabulary called 'Sitemap' with a term for each page, which could be selected from a term reference field in the 'Subject' content type. I then use a view to spit out all of the referenced 'Subject' nodes associated with that term as rendered entities.

TL;DR - I have a series of taxonomy term pages full of referenced rendered entity nodes.

When looking at implementing search I just can't get my head around how to index and display results. I obviously need the contents of these term pages to be indexed, but I also need to ensure that results will only point to term pages (preferably deep linked) and not any of the original nodes referenced on the term page. Granted, I'm not very familiar with it, but looking at Search API I can't see how I could achieve that.

Is this just a really silly way to achieve this kind of structure?


texts: Find webform submission ID in a custom submission handler

texts:
I have created a webform custom submission handler.

public function submitForm(array &$form, FormStateInterface $form_state,  WebformSubmissionInterface $webform_submission) {
  $webform_submission->getDate();
}

I am getting all the submitted values except the submission id. How do I get that value?


texts: How can I move the modules that are dependencies for a module of mine in another directory?

texts:
I want to create a custom module with 2 dependencies. My module will be in sites/all/modules, and I need its dependencies to be in /modules/contrib.

How can I move the dependencies? I don't need any Drush command. It must be done using the browser only.


texts: I am using Drupal 7.17, and have created content of type book. I want the users to be able to export it to PDF format. The pages contains images, HTML tables, HTML ordered and unordered list (ul and li). What is the best way to do this? The content styles should be preserved when exported.


texts: Check if the user is logged-in in a theme

texts:
In Drupal 7 we can simply check if the current user is logged-in in a theme by checking $GLOBAL['user']->uid or  using user_is_logged_in().

How can I check if a user is logged-in in a page template, in Drupal 8?

A solution is to manually check in hook_preprocess_page(), but since this is very popular, I think  Drupal provides something by default for the Twig theme engine.


texts: Rules - Set language of message notification

texts:
We need to set up a rule that will send an email in the language of the Customer of an order LANGUAGE.

But the Message notify action in rules takes the CURRENT user interface language... so that might be fr or en, depending on the path in fact. The recipient language might be different.

1-Can you tell me what selectors I should use to set the mail language to the customer language? I guess I need to change some kine of data-value?

2-And maybe you can point how I can easily find this in the future. Would DEVEL help? Something else?

thanks!


texts: Call to undefined function lock_acquire with Drush on Drupal 7

texts:
I’m running my local development sites on a Windows machine with Uniserver.  I have them all set up as vhosts.  Most of them are Drupal 7, but a couple are Drupal 6.  I installed Drush for Windows using the Drush Windows Installer.  My problem is that when I navigate to any of my Drupal 7 sites and attempt to clear cache with “drush cc” I get

Enter a number to choose which cache to clear.
 [0]  :  Cancel
 [1]  :  drush
 [2]  :  registry
2

Fatal error: Call to undefined function lock_acquire() in G:\UniServer\vhosts\myDrupal7site\includes\bootstrap.inc on line 3198
Drush command terminated abnormally due to an unrecoverable error.       [error]

Error: Call to undefined function lock_acquire() in
G:\UniServer\vhosts\myDrupal7site\includes\bootstrap.inc, line 3198

When I do the same thing with my Drupal 6 sites I get:

Enter a number to choose which cache to clear.
 [0]  :  Cancel
 [1]  :  all
 [2]  :  drush
 [3]  :  theme-registry
 [4]  :  menu
 [5]  :  css-js
 [6]  :  block
 [7]  :  module-list
 [8]  :  theme-list
 [9]  :  views
1
'all' cache was cleared in self                                        [success]

which is to say no problem.  I’ve checked that lock.inc is there in the /includes directory.  Probably related to this is that my Drupal 7 sites hang pretty frequently, while the Drupal 6 sites work fine.  Can anyone give me some direction on dealing with this?


texts: Creating module can display map in page or block in drupal

texts:
I have two days I'm trying to develop my custom module.
I want to display map in block but nothing happened.
how i can called css an js file and show them in page or block?

function exemple_init() {
  drupal_add_js('http://maps.googleapis.com/maps/api/js?sensor=false', 'external');
}

function exemple_block_info() {
  $blocks['exemple'] = array(
    'info' => t('Google Map Exemple'),
    'cache' => DRUPAL_NO_CACHE
  );
  return $blocks;
}

function exemple_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'exemple':
        $block['content'] = '';
  }
  return $block;
}


texts: Using D7 OG I want to force (auto) join - any ideas?

texts:
I'm using D7 Organic Groups to create custom member profiles such that when a new user registers, a rule creates a group with their name (/member/firstname-lastname) and redirects them to their group's home page where there is a "build-profile" panel using quicktabs to guide them through the 7 steps of building a complete profile.  The build panel is visible until such time as they complete the final step at which point they are autoassigned a new role which uses a different page layout sans the build panel.

This all works well.  When users browse for other users they are actually directed to the associated /member/firstname-lastname page for the user whose profile they are viewing.

Here is the issue I'm now having.  I need to make it so that when a user "follows" another user (joins or subscribes-to their group) I want the owner of the group being followed to automatically "follow" (join or subscribe-to) their group.

This is really only doable because each member only "owns" or is admin to a single group, so it should be relatively easy to say - if user-a (owner of group-a) joins group-b (owned by user-b) then user-b joins group-a.

I'm just not sure programatically how to do this.  Can anyone help me with a code snippet to do this?


texts: How to export content from dev environment for deployment to production environment?

texts:
We have to deploy content of around 37 content types from development to production environment. Each content type is having around 10 to 12 nodes.
So, we have around 360 nodes for migrating to production environment.

How can i proceed it with at drupal end ?


texts:
I have created a form using which I want to make changes in the configuration.Currently I am submitting form doing something like this:

 public function submitForm(array &$form, FormStateInterface $form_state) {
  \Drupal::service('config.factory')
    ->getEditable('module.settings')
    ->set('module_entities', $form_state->getValue('module_entities'))
    ->save();
 }

But the problem is when I have submitted the form changes in the configuration are not reflected.But when I clear the cache after submitting the form the changes are reflected.what changes should I make so that when user submits form the changes are reflected thereafter?

Update: I tried to find my mistake and found out that configuration is getting updated but somehow the changes getting lost and not being reflected in the block which I have created. In the block creation code I am creating blocks for different entities depending on the entities present in the configuration.But the configuration is not showing correct values so block for required entities is not being created.Surprisingly when I clear cache the code works(which means configuration becomes updated).Does this mean for block creation I need to clear cache?
I am currently using this code:

 `public function getDerivativeDefinitions($base_plugin_definition) {
   $this->derivatives[$entity_type] = $base_plugin_definition;
   $this->derivatives[$entity_type]['admin_label'] .= ' (' . $entity_definition->getLabel() .')';
   $this->derivatives[$entity_type]['cache'] = ?;

}`

What should I add over here to make block depend on configuration without clearing cache?
In the plugin I am returning:

public function build() {
return array(
  '#theme' => 'links__entity__module',
  '#links' => $this->linkBuilder->buildLinks($this->request->attributes->get($entity_type)),
      );
}


texts: Can't get url from internal uri in twig template file

texts:
I have tried every suggestion I could find and nothing is working. I need to get the actual path or url since I am adding some specific classes to the link. The array is below

I got to this from the following

{% set link = paragraph.field_link.value.0 %}
{{ kint(link) }}

I understand that I need to use the url() or path() function but these require 2 parameters and I am unsure where to get these from.


texts: get variable indicating node preview mode (D7)?

texts:
I would like to display a specific message to users when they are previewing a node they are submitting. So I thought I would use a block with PHP code, using some info indicating that the node is being previewed.
Unfortunately, I cannot get it working. I have tried these conditions:

if ($variables['view_mode'] == 'preview') ...

I get this error:

  Notice : Undefined variable: variables in eval() (line 4 in
  /.../modules/php/php.module(80) : eval()'d code).

Tried this too:
if ($node->in_preview == TRUE) ...

I get these errors:

  Notice : Undefined variable: node in eval() (line 5 in /.../php.module(80) : eval()'d code).
  Notice : Trying to get property of non-object in eval() (line 5 in /.../php.module(80) : eval()'d code).

I guess I have to declare the variable before, but how? I thought that since the
node form is rendered anyway, the needed variable was available?


texts:
I setup a website based on Drupal8,create some content type(with several fields),Now I want to enter some test data in my site.
How can I generate test data bulky in drupal8?


texts:
Broadly, I'm having problems running drush sql-sync so that I can get a local copy of my dev database. I was getting an "The external command could not be executed due to an application error ... code: 255)" type thing.

To diagnose the problem more specifically, I ran drush @local sql-conf and got

 Array
    (
        [driver] => mysql
        [database] => soa
        [username] => drupaluser
        [host] => 127.0.0.1
        [port] => 33066
    )

When I then ran drush @dev sql-conf I got

Permission denied (publickey,password).

Running drush @dev sql-conf -s results in

Simulating backend invoke: ssh -o PasswordAuthentication=no git@dev.sub.mysite.com 'drush  --invoke --simulate --root=/var/www/dev --uri=http://default  sql-conf   --site=sub --env=dev 2>&1' 2>&1


texts: Custom #ajax "Add another" button only adds 1

texts:
This form consists of 1 textfield, and 1 ajax button.

I'm trying to make it add another text field with each click.

It works for the first one, to get a total of 2 text fields. I cannot get more than 2 to appear though.

I suspect the dom is being updated, but not the form. So the subsequent callbacks add an element based on the original form build.

I'm not sure how to approach this in Drupal 8. Any insight would be appreciated.

Here is my form control

<?php
...
class MyModuleForm extends FormBase {
  ...
  public function buildForm(array $form, array &$form_state) {
    $form['foo'] = array(
      '#type' => 'container',
      '#tree' => TRUE,
      '#prefix' => '
',
      '#suffix' => '
'
    );
    $form['foo'][0] = array(
      '#type' => 'textfield'
    );
    $form['add'] = array(
      '#type' => 'submit',
      '#name' => 'add',
      '#value' => t('Add'),
      '#ajax' => array(
        'callback' => array($this, 'addMore'),
        'wrapper' => 'foo-replace',
        'effect' => 'fade',
      ),
    );
    return $form;
  }

  public function addMore(array $form, array &$form_state) {
    $form['foo'][] = array(
      '#type' => 'textfield'
    );
    return $form['foo'];
  }
}


texts: Dynamic product creation in drupal commerce

texts:
Say you want to make a product 'blend'. Keeping it simple, say that there are 3 products your store sells. product 1 contains only X and costs $7.00 per Kg. Product 2 contains 40% X, 60% Y, costs $2.00 per Kg. Product 3 contains 30% X, 20% Y, and 50% Z and costs $6.00 per Kg.

Its easy enough to run this through a linear algebra equation and find out that X = $7 per KG, Y = $2, and z = $7.

So for instance, The customer would select his blend. He would like a ratio of 1:2:4, and would like 50 Kgs of it.

The question I have is, how do you go about selecting that ratio, and applying the quantity as well. Its almost as if you have multiple quantities in effect now.


texts: Rendering a field in a custom print template

texts:
I'm using the Printer, email and PDF versions module to render a custom print page in Drupal 7. I'd like to theme the fields individually and have worked that out to the point of using nasty php in my custom template itself.

So, I have a content type called ecard and following the module's documentation, I'm using print--node--ecard.tpl.php (based on the modules's core print.tpl.php file) for my custom print template. That works fine but the usual ways of rendering individual fields like in a node template don't.

I can do this within print--node--ecard.tpl.php to render an indivdual field called field_ecard_logo:

<?php
$ecard_logo = field_view_value('node', $node, 'field_ecard_logo', $node->field_ecard_logo[$node->language][0]);
print render($ecard_logo);
?>

... works but kind of nasty. I'd rather put all the logic in my theme's template.php and simply print a variable I've created. Looking at what preprocess functions the Print module uses, I see preprocess_print and preprocess_node. So I tried this in template.php:

  function MYTHEME_preprocess_print($vars) {
      $node = $vars['node'];
      $vars['ecard_logo'] = field_view_value('node', $node, 'field_ecard_logo', $node->field_ecard_logo[$node->language][0]);
    }

and then in print--node--ecard.tpl.php, I simply do:

<?php print $ecard_logo; ?>

but that does not work. I tried different incarnations of all this but no joy so at this point I'm stumped.


texts: Why I can't use the same code from Drupal 7 in Drupal 8 to generate a button with FAPI?

texts:
Following the question Generating <button type="submit"> with the form API for Drupal 7 I tried to implement the same thing in Drupal 8.

I need the following output:

<button type="submit" class="clearfix">Login</button>

So I tried to use this code:

$form['submit'] = array(
  '#prefix' => "<button type ='submit'>",
  '#suffix' => "</button>",
  '#type' => 'markup',
  '#markup' => "" . t('Login') . "",
);

But I obtain this:

Login

But if I use this code:

$form['submit'] = array(
  '#prefix' => "",
  '#suffix' => "",
  '#type' => 'markup',
  '#markup' => "" . t('Login') . "",
);

I obtain this:

Login

So the <button> tag is eliminated but the  tag not. Very strange for me, the Button is not rendered.

Thanks to @Kevin I used the leymannx answer an with this code I solve the problem:

$form['submit'] = [
  '#type' => 'inline_template',
  '#template' => '<button type="submit" class="glyphicon glyphicon-search"></button>',
];

But, why I can't use the same code in Drupal 7 and Drupal 8 to generate a button with FAPI?


texts:
I have added a block which shows the no of items added to an entity. I want to refresh the block through ajax as the items are added to an entity through ajax form so whenever I add an item, it will refresh or re-render the block content too.

I found some of the modules, but they are in Drupal 7 and not available for D8 so I want to make it done with my custom module but didn't find anything useful.

UPDATED

I have added the class attribute with the block and whenever I add any items, I made an ajax request through javascript which calls the respective controller and at the same time, I run this too--

// This is a part of the controller function from where I am calling below defined methods.
$this->updateBlock();

protected function getBlock() {
    $block = $this->blockManager->createInstance('block_id', []);
    return $block;
}

public function updateBlock() {
    $block = $this->getBlock();
    $this->response->addCommand(new ReplaceCommand('.block--class', $block->build()));
    return $this->response;

}

But It is not updating the block.


texts: How authenticated users can choose favorite products and show them in their profile?

texts:
in my drupal project, I want to have many products specification. I want authenticated users can choose their favorite product and they can set price for favorite product. these favorite products can show in their user's profile. and in any product page, all users can see all of the prices that set by authenticated users.

In Drupal 7 which approach / technique should I use?


texts: Rules scheduler and views- how to show normal users the schedule?

texts:
I am using Rules Scheduler and Flag to handle troublesome users by issuing a one-week ban.  I flag the user with a temporary ban flag, and then the user sees a special block that says "You have been temporarily banned for being a jerk."  I have a rule that automatically schedules the user to be unflagged one week later.
However, I want to show users how much time they have remaining.  My first thought was to create a block/content pane in Views, so I made a view of type Rules scheduler, but when I went to add the UID as a Contextual Filter, I realized that Rules scheduler views only provide these options:

Null
Component name

Is there some other way I can show the user how much time they have until an arbitrary Rules Scheduler action will be evaluated?
What I tried
Based on this question, I added a filter for user-provided identifier, set the value to a garbage value (punishme), and added views_pre_view() as follows:
function MYMODULE_views_pre_view(&$view) {
  global $user;
  if ($view->name == 'punishment_show_details') {
    if ($user->uid) {
      $newvalue = 'punish/' . $user->uid;
      $view->display[$view->current_display]->handler->options['filters']['rules_scheduler']['value'] = 'punish/' . $user->uid;
    }
  }
}

However, this doesn't work; for some reason, when I dpm() the view, the value for filters is empty.


texts:
I have a website where i manage to create a database, display it with the views module and add a Search box with Search API.
I followed this tutorial: http://webwash.net/tutorials/how-create-search-pages-using-views-drupal-7

I'm using a bundle filter in my Index. My page only shows and search content from a specific content type.
On that content type i have a field "category" with 2 radio options.

What i want to do is be able to filter the search by that category: If i choose option A, when i type my search it will only search the content within that category.

It must be really easy but i just can't figure it out. You guys have any ideas?

Thank you so much in advance!


texts: How to add css class to a field from a select list before rendering?

texts:
I have a select list which has the following values where the key values are the same name as the css class name.

List1:

prim-blue|Blue
prim-black|Black
prim-orange|Orange

We also have a text field which is surrounded by the following div tag below. Before the page renders, we want to take the value from list1 and assign it as a class to the div tag. We need assistance in figuring out how to get this to work using a preprocess hook.

/*css*/
prim-blue {
   //some attribute
}
prim-black {
   //some attribute
}
prim-orange {
   //some attribute
}

/*field div tag */

 Some text values

Desired results (when page renders):

**Assume list1 is set to Blue (key: prim-blue)

 Some text values

Note (to provide more context):

I am using the paragraph module which a bundle that has a background color for list1 and the text field. Then on the basic page content type, i added a paragraph field.

Paragraph bundle fields:

text (field_text)
background color (field_bkg_clr) <-- the drop down list1

Basic Page content type:

Header (field_pr_hdr, which is of type paragraph)


texts:
I need a poll inside my content types.

Sometimes the users create an article and like to create a poll directly into the node they created. They don't want to create an extra poll with no connection to the original article.

So how can I get the poll functionality inside a different content type?


texts: Secondary & Tertiary links next to Parent links

texts:
How can I print expandable secondary and tertiary links to the right of the parent?
For mobile, the secondary and tertiary links will need to stack below the parent links. Below is an example of what I am looking to achieve.

Menu tree

Menu on front end


texts: How to display references entities in single field?

texts: I have a view of nodes. These nodes are connected with users via entity reference. User has a profile (Profile2). I want to display profile fields for all referenced users in single field.


texts: How can I return a JSON response from an internal function ? (not the main callback)

texts:
I have a callback that is running for a specific post request.
I am returning a certain JSON response at the end of it.

What if I want to catch errors inside one of the functions that are ran in that callback ? How do I get the Response object, or is there another way of sending a response immediately in case errors are catched ?

  private function someCalculation()
{

  try {

  } catch ($e) {
    //how to send response in case of error inside this function
    return new JsonResponse([
      'data' => null,
      'error' => $error
    ]);
  }
}

public function getTemplate(Request $request)
{

  $this->someCalculation();

  return new JsonResponse([
    'data' => $result,
  ]);

}

How do I send a JSON from inside the someCalculation function in case some errors are found ?


texts: Drupal 8 Accessing Menu Tree in a Block's JS

texts:
How can I pass the menu into a block's javascript?

I am trying to build a block for a custom mobile menu (client wants specific logic/animations/etc) and use that in Structure > Block layout > Main Navigation.

They want me to do it via jQuery for reasons, but I cannot find how to get access to the menu tree in the javascript of the block. I feel like this should be simple enough with the API but the documentation seems to be all focused on PHP.

Any help is appreciated, thanks!

NOTE

I did find this post but I'm honestly not sure what it is trying to do, it is from about 4 years ago, and making/bundling libraries to just access the menu seems like it is probably not the ideal way to do this. Also I am using Bootstrap's theme and I do not see a template.php.
Thanks again!


texts: How to add a second Contextual Filter to the calendar view? (this view is automatically created by the calendar module)?

texts:
I have enabled the calendar module which generate a new view called calendar.

The calendar view has a page called month with just one contextual filter. It works fine.

The problem is that I to added a second  contextual filter.This is what I've done:

The content type that this view page shows is: "actividades".
This content type has the field "poblacion" of the type (term reference).

Then in the view:

I added a Relationship: Content: Taxonomy terms on node
I added the Contextual Filter :(term form Poblaciones) Taxonomy term: Name .

But it's not working at all. I think I need to modify the path of this view page which at the moment is: actividades/month. But I don't know how...

If I go to the url: actividades/month/barcelona it doesn't work even though I have a node tagged with this term. I guess this happens because the first argument is for the date, here is where I get lost


texts: I have a View filter that contains a list of taxonomy terms; the problem is that when i add new terms to the vocabulary, the new terms are not automatically added to the filter view so i do not see the nodes related to the new terms. Is there a way to link the filter to the vocabulary by saying "all the terms"?


texts: Can the Autocomplete delay be lowered in forms?

texts: I have seen that the autocomplete widget in Forms API is started when I finish typing, or when there is a delay between one key hitting and the next one. Could it be configured so it is launched as soon as I press a key, like in Google Autosuggest or other search boxes?


texts:
I am using drupal 7.

I have uploaded pdf files into

files/private

Now I want that when I try to access

www.site.com/sites/default/files/private/q1-2014-fs.pdf

It will open. Only if user is activate then he can able to see file

I have created a .htaccess file too

in that

Deny from all

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

Can anybody tell me, where am I doing wrong.


texts: Add Profile 2 -> Field Colleciton -> Taxonomoy into Facet (Search API)

texts:
I'm trying to display a Facet block , which uses Term reference (Taxonomy) of Field Collection of Profile 2. Since I am new to Search (API), I have tried all sort of things but nothing worked.

For example:

Use Facet display of View: Rendered entity, Field..
Use Facet Block from Search API
Config options in Search /Search API..

In
Home » Administration » Configuration » Search and metadata » Search API » View index

I added Facets the followings:

Vocabulary: Facet blocks look good in the picture below
Profile2->Field Collection: look good in the picture below
Profile2->Field Collection->Vocabulary(Taxonomy): bad,It always shows empty

My Question is:

How can I make this happen? or Is it possible to do it?


texts: What is the progress bar periodic update function return data?

texts:
In Drupal 7 from the function called with 'url/to/call/progressbar/update/function' (see below) you would return an array converted to JSON like this:

drupal_json_output($message);

I cannot find any examples for Drupal 8 and I suspect it's an object rather than an array that gets returned.

Does anyone know how/what to return from the progress bar update function?

The setup for the bar progress indicator would be something like this:

$form['some_item'] = array(
  '#type'  => 'submit',
  '#value' => t('My action'),
  '#ajax'  => array(
    'callback' => 'a_function',
    'wrapper'  => 'ajax-response-goes-here',
    'method'   => 'replace',
    'progress' => array (
      'type'     => 'bar',
      'message'  => 'Starting...',
      'url'      => 'url/to/call/progressbar/update/function',
      'interval' => '1000'
)


texts: why are nodes not being reassigned to new term when termid is changed?

texts:
I'm having to create new taxonomies for a client and they want nodes that are associated with these terms and taxonomies to be assigned to the new taxonomy, I have done this via MySQL with an update statement so that all nodes associated with a certain term are now associated with the new one e.g.

UPDATE taxonomy_copy
SET tid = 316
WHERE tid = 152

Now when I do my select * query it shows all the nodes are associated with the new taxonomy but when I check the front end the node is still associated with the previous taxonomy, I've cleared cache and history and this still doesn't help.

Any Ideas how to resolve this issue??


texts: Incorporate dropdown list of nodes into a webform to link webform results to said content

texts:
I am trying to link the results from a webform comment survey to content that was previously generated within a site so that the webform_submissions table in the database shows the node those answers are attached to.

I am planning to use a "node reference" dropdown to the content type I need, but that's as far as I've gone.

Any ideas or suggestions are most appreciated.


texts: Why can not Drupal find my theme for a custom block?

texts:
I read this answer, but I can not figure out, why my block is not shown. My block is activated in footer and should appear on <front>.

/**
 * Implements hook_theme().
 */
function poll_dialog_theme() {
  return array(
    'poll_dialog_output' => array(
      'variables' => array(
        'title' => NULL,
        'content' => NULL,
        'popular_content' => NULL,
      ),
      'template' => 'theme/poll_dialog',
    ),
  );
}

function poll_dialog_block_info() {
  $blocks['poll_dialog'] = array(
    'info' => t('Poll Dialog'),
    'cache' => DRUPAL_NO_CACHE, //there are a number of caching options for this
  );

  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function poll_dialog_block_view($delta = '') {
  switch ($delta) {
    case 'poll_dialog':
      $block['subject'] = t('poll_dialog');
      $block['content'] = _poll_dialog_block_content();
      break;
  }
  return $block;
}

/**
 * Callback implemented by hook_block_view().
 */
function _poll_dialog_block_content() {
  $static_title = t('Static Title');
  $static_content = 'static content';

  return theme('poll_dialog', array(
      'title' => $static_title,
      'content' => $static_content,
      'link' => l('Poll', 'some url'), array('attributes' => array('target' => '_blank'))),
    )
  );
}


texts: Difficulty getting Rules Scheduler in D7 to publish a node in the future

texts:
I've set up rules to defer publishing on node save to a specified date. The rules component successfully runs at the later date and sends an email alert to the node author to let them know that their node has been published. But the rules component does not succeed in actually publishing the node.

I am pretty confident that the component works OK, because if I execute it directly, providing the node id as the content identifier (using direct input mode), it works as expected, i.e. sends the email alert and publishes the node.

The issue arises only when the component is run by cron. My best guess - drawing on this stackoverflow Q&A - is that this may be connected to cron, on D7, always being run as the anonymous user.

I'm puzzled, however. There are several D7 discussions around of how to use Rules to defer publishing, e.g. this Drupal Answers Q&A or this drupal.org comment (about using this approach on D7 - it is a comment on a D6 page). The fact that neither of these mention any issue with the anonymous user, make me wonder if I'm getting something very basic wrong and/or have an unusual configuration. It would seem odd that Rules Scheduler couldn't, more or less out of the box, achieve deferred publishing.

I've looked at the 'Configure access for using this component with a permission' option for the component and tried out various settings of that without fixing the issue. I'm not clear I understand the function of this option and haven't found any documentation / Q&As so far that have helped.

For reference, the rules component (that works when executed manually using the node id, but send the email without publishing the node when triggered by cron) is (when exported) as follows:

{ "rules_publish_content" : {
    "LABEL" : "Delayed publish action",
    "PLUGIN" : "rule set",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "delayed_node" : { "label" : "Delayed node", "type" : "node" } },
    "RULES" : [
      { "RULE" : {
          "IF" : [
            { "node_is_of_type" : {
                "node" : [ "delayed-node" ],
                "type" : { "value" : { "news" : "news" } }
              }
            },
            { "NOT node_is_published" : { "node" : [ "delayed-node" ] } }
          ],
          "DO" : [
            { "mail" : {
                "to" : [ "delayed-node:author:mail" ],
                "subject" : "Your item, \u0022[delayed-node:title]\u0022, has been published.",
                "message" : "Your item, \u0022[delayed-node:title]\u0022, has been published.\r\n\r\n[delayed-node:url]\r\n\r\nnode id: [delayed-node:nid]\r\n\r\nnode date: [delayed-node:field-date]\r\n\r\nnode status: [delayed-node:status]\r\n",
                "language" : [ "" ]
              }
            },
            { "node_publish" : { "node" : [ "delayed-node" ] } }
          ],
          "LABEL" : "Delayed publishing: publish and alert"
        }
      }
    ]
  }
}


texts: How do I get a block and its content commited to a Git repo?

texts: Let's say I have created a block with some Full HTML (Facebook Feed) text inside. How can I commit the block and its text content into my Git repository, so my co-workers can pull it?


texts: Scan Remote FTP server (Akamai) for files, use filename to create content

texts:
I'm wondering if there is an existing workflow to achieve what I'm looking for before I'm forced to go and build my own.  This is, preferably, in drupal 7.

I have media files stored on an akamai server that need to be scanned either via a cron or manual start and after they're scanned, their filenames need to be put into separate content.  I do not need the files individually parsed, I just need the filenames added to title and add the filename to a textbox within the created content.

I have found a few methods that sound similar to what I'm looking for such as:
- Storage API: Does connect, but cannot find files that were not uploaded via their service.
- File Field Sources: No remote FTP, but does scan local and such.
- Bulk Media Upload: Does scan and create a new node for each, does not do remote.

Any ideas?


texts:
I've got a views block that shows data from node field.

I've set up a contextual filter

NID:

WHEN THE FILTER VALUE IS NOT AVAILABLE

Provide default value: content ID from url.

I've also set up a context show this block

Condition: Node Type

Reaction Block

It works fine, but if the field is empty it will show Block title and empty content.

Is there a way I can hide the block if the view is empty?

Thanks in advance


texts: Drupal 7 Views 3.13 Filter groups returns nothing if one group is empty

texts:
I have a need to display a block with nodes from different content types.  The content types contain different fields, and I would like to filter based on different criteria of each type.  I had hoped to use the grouping function of Filter Criteria, but it's not operating as expected.

I am using two content types, Article and Career.  Career has a Status field, which indicates if the career posting is open or closed.  The filter criteria I have designed looks like:

Each part on it's own works as expected..  so if I remove "OR (Career AND Open)", I get a list of articles that meet the criteria.  Conversely, if I remove "(Article AND Published AND Promoted) OR", I get open careers.

Together, I get the result of the 2nd group - I only get open Careers, and no Articles.

If it matters (not sure that it does .. ?), the fields I'm displaying are the node title, and two custom fields that are common to both content types.

Help please?


texts:
I can't figure how it is possible that the table I define in a hook_schema is created when I enable my module, but it isn't deleted when I uninstall the module (after disabling).

Drupal 7 documentation sais that the table should be automatically created and deleted when these events occours.

Here is the relevant part of the code inside my_module.install:

function my_module_schema(){
    $schema = array();
    $schema["my_module_table_xyz"] = array(
            ...
    );
    return $schema;
}

I don't know if it could be related to the difference between the modue name and the table name... or from the code present in the hook_uninstall... or something else...

Considering I also define a node type, the hook_uninstall should delete it (see following code), then system should automatically uninstall previously defined schema.

function my_module_uninstall(){
    ...
    node_delete_multiple(...);
    // delete custom fields
    node_type_delete(...);
    field_purge_batch(...);
}

What do you think about?
Thanks

NOTE: I use Drush to disable, uninstall and reinstall the module and I get the error Table my_module_table_xyz already exist.

Update: I just verified that the same code in a clean Drupal installation works as expected (table defined in hook_schema have been successfully removed).

In the "problematic" Drupal installation I also tried to explicit run drupal_uninstall_schema("my_module_table_xyz") at the end of the hook_uninstall (and I inserted a log instruction just after that line, to verify it runs without breaking), but nothing change. The table is stille there!

Any idea/hypothesis about will be really appreciated.


texts: Create hierarchical taxonomy url alias with token term:parents using a field other than term:name

texts:
Sorry, the title is a bit of a mouthful but I will attempt to clarify.

I have a question about pathauto tokens to create a URL alias for a nested/hierarchical taxonomy.

Specifically, I have a taxonomy called Category, which is n layers deep; e.g:

  Category level 01 > Category level 02 > Category level 03

And so on. The question appears to have been asked many times before and there are a number of good solutions, including the following pattern:

  [term:parents:join:/]/[term:name]

This yields the following url alias for the above example:

  category-level-01/category-level-02/category-level-03

Pretty straightforward. This would be perfect except in my example the taxonomy terms are in Chinese.

I need English in the path aliases, so I have set up a new field in my taxonomy called 'Name English'. This gives me the following replacement pattern:

  [term:parents:join:/]/[term:field_name_english]

Which is almost perfect, but the parents default to using the name field, and there does not seem to be an easy way of overriding this. I cannot use the parent taxonomy terms with delta because it's not dynamic; e.g:

  [term:parents-all:1:field_name_english]/[term:field_name_english]

Some taxonomy depths will be deeper than others.

So, in summary, I need to somehow specify an alternate term field to name for the [term:parents] token. To do this I assume I will need to do one of the following:

Create a custom token
Override the current [term:parents] token

Can anyone advise on this? Thanks a million.


texts:
I'm starting in on drupal search engine and I am looking to create a search page. First I would like the search is on very specific fields of some content types. What can be done with the basic module "Search" Drupal and "Views"?

Here is a draw of the search page I would like :

Filter 1,2, 3 are checkboxes to filter on content-type after the search.

I have no idea where to start :(.

---------- I add some explanations

I installed the module and SearchAPI followed a tutorial at: http://webwash.net/tutorials/intro-search-api-part-1-how-create-search-pages

This module is very powerful to index only the fields you want, thank you for this discovery. Being an intern student, I am not allowed to release details on what the project, but I'll offer you a similar example.

We have 5 different types of content: car, motorcycle, boat, Helicopter and plane. Each type has common fields and fields of its own.

Car: Name, Brand, Fuel, Transmission
Moto: Name, Brand, Fuel, Transmission, Max Speed
Boat: Name, Brand, Fuel, GPS
Helicopter: Name, Brand, Fuel, Number of propellers
Plane: Name, Brand, Fuel, Number of reactors

I want to index Name, Brand, Transmission, Number of propellers, and number of reactors. (I think it's doable quite easily with SearchAPI)

On the drawing on the filter tabs, I would like three tabs: Car, Motorcycle and Other which includes: Boat, Helicopter and Airplane.

By default, the validation of the text field reloads the page, such as a GET or POST form. It reload returns the results for the 5 types of content, so the 3 tabs are checked by default. After reloading, the user can check and uncheck the tabs to filter results by content type (Ajax or simple JS filter on CSS class, I do not know yet).

Another difficulty, my project manager wants the search results are like this:

Title of the node

Field corresponding to the search results. (Can be Name, Brand, Transmission, Number of propellers, or number of reactors)

I hope to enlighten you about my problem. I do not want a ready-made solution, but how to achieve it. Is it doable in the first place ...


texts: CCK fields don't appear on the "node add" form for authorized user

texts: I would like to allow logged-in users to create nodes, and I gave them the permission to create "some_content," but on "add node form" users have only one field, which is for custom node title, without any other CCK fields that this content type have. Could anybody tell me how to add those fields to this form?


texts:
I'm creating a custom multilingual template. I used {% trans %} function in the twig. After adding new language I could not found the text i placed between trans tag. Do I need to configure sth more to get these strings into drupal's translations panel ?

   {% trans %}   Do you have any ideas or questions? Feel free to contact us, using the form below.  {% endtrans %}


texts: How can I migrate the Domain publishing settings for nodes via SQL?

texts:
I am using Drupal 7 and Domain Access (latest stable versions).

In my source site, there are nodes with "Domain access options", "publish to.." then a number of selected domains.

I migrate the data in the node_access table, mapping the old nid to the new nid using the migrate_map_xxx table.

However when I view a Node which has rows in the node_access table, publishing the node to certain domain id, the relevant box is not ticked on the node edit page.

When I rebuild permissions, the rows of data I migrated into node_access disappear and the node is still published to just the default domain (three other rows were inserted into the node_access table, now there is just one).

How can I migrate the publishing options for nodes from one DB to another?


texts: Assign specific template to specific pages

texts:
H i I am quite new in Drupal and have been trying to figure out a way to assign a specific template file to some specific pages following the taxonomy like page--user--edit.tpl.php works but I don't want to create a single template file for each page I require to change. I have been trying the following code but this doesn't work for me is there any cleaner way to achieve this in drupal 7

function phptemplate_preprocess_page(&$vars) {
 if (arg(0) == 'node' && (arg(1) == '10')) {
   $vars['template_files'][] = 'page-sometest';
 }


texts: How to migrate data from custom user account fields to a single new field?

texts:
For my Drupal 7 User Accounts I have 5 separate fields (Field Type: Boolean, Widget: 'Single on/off checkbox') used to indicate comms preferences.

Without losing any data I want to migrate these fields to single field (Field type: 'List', Widget: 'Check boxes/radio buttons') but I am not sure how to achieve this?


texts: How to change title of profile-profile2_machine_name only, but not profile-profile2_machine_name/%user

texts:
I'd like to change the title of my profile-profile2_machine_name page, but not the page profile-profile2_machine_name/%user page.

This is because I have a settings menu for each user in my profile-profile2_machine_name page and it's a private profile page, while profile-profile2_machine_name/%user is the public profile page.

I've tried many things but when using arg, drupal_get_path_alias() and $_GET['q'], I see that both pages return the same value, which is profile-profile2_machine_name/%user


texts: Prevent editing for role after date in field

texts:
Individual nodes of a content type need to have their edit capability for a role removed after a date provided by a CCK field. The idea is that these nodes are entered by various roles, given a "start date" and displayed on the site in a few layouts. After the start date has passed, the node should be uneditable by this specific role.

How can this be achieved, is it possible by using a module-only method or can it be done in code?


texts: Views: Multiple Contextual Filters (Taxonomy)

texts:
My view should be filtered by multiple taxonomy terms, e.q. : show me all "events" that are tagged by the terms "show", "age over 40" and "outside".

While I can filter by one taxonomy term just fine, it is not working with multiple terms.
View Settings:

Relationship: Taxonomy terms on node

Contextual Filters: (term) Taxonomie-Term: Name
Allow multiple values is checked!

What am I doing wrong?

I need to filter by the name, not the ID.


texts: Best practice to represent a schema with nodes

texts:
I was wondering what would be the best practise to map my schema within Drupal in order to make them searchable and given some restrictions with the Search API and Views.

My schema is the following:

I want to represent trial cases, their instances and their documents, so I am having let's say 2 nodes:

Case:

case-ID: Text
case_name: Text
case_documents: Entity Reference to Case document
etc...

Case document:

title
document_date: Date
attachment: File
etc...

I would like to implement a search that allows e.g. to search for the case-id, fields that belong to Case document as well as the full text of the attachments. I am working with Search API, Search API Solr, Search API Attachments and a Solr backend

The above without the requirement to search full texts of the attachments, could be implemented with Views and Entity References, but when one wants to implement a view over an index, for the moment it simply doesn't work, see this feature request

Is there any alternative way to work around those limitations


texts:
currently i'm trying to consume drupal service from phonegap and php file.I'm using drupal 7x with services 3.5.Right now login and logout works,but after logout,the page doesn't refresh as it should be.And it gives me this on firefox console :

return get with ?_=

Here are my codes :

[code] http://pastebin.com/M3FbsgBt

When i refresh the page,the get dissapears,does such behaviour is normal?How can i make it works as expected?Thanks.


texts:
I've added some database fields (8 in all) for a node into a field-group set using the Field Group module. However, I cannot seem to get the data fields to show up for insertion in a node panel page I created to "display" a node page that shows for entering a new node form.

How do I get the fields to show for the relevant Node on the page, without using a view or creating tabs?


texts:
I have a multilingual website in Drupal 7. It has a menu bar with 10 menu items. Among them I have translated 5 menu items to Dutch. When I switch the language from English to Dutch, only the translated menu items appear. I would like to display those 5 menu items in Dutch as well as those items which are not translated in default English Language.

Could someone propose me a solution or a module to implement the same.

Most solutions are for individual content or entire Menu and not for individual menu items.

Thanks in advance for the help rendered :D


texts: How can I loop through entity reference values?

texts:
My content type "Export" has an entity reference to the type "country" (i.e. you assign countries to the export). I wish to do something like the following

$countries = $node->field_exporter_countries['und'][0]['value'];

foreach ($countries as &$value) {
   print $value;
}

Edit

I also tried this. But i get the wrong titles back.

$nodes = entity_load('node', array_keys($countries));
foreach ($nodes as $n) {
  print $n->title;
  print "<br /> ";
}


texts: How to render a view programmatically and set as node field?

texts:
I am trying to render custom view and put the result as content of the node.

Here is my code

function my_theme_preprocess_node(&$variables)
{
    if (isset($variables['node']) && $variables['node']->getType() == 'custom_type') {
        $reference_view = $variables['node']->field_reference_view->first();
        if (!empty($reference_view)) {
            $view_name = $reference_view->getValue()['value'];
            $view = \Drupal\views\Views::getView($view_name);
            $view->setArguments(array());
            $view->setDisplay('block');
            $view->preExecute();
            $view->execute();
            $variables['embedded_view'] = $view->buildRenderable();

        }
    }

}

But this code shows only debug message and when I try to get output in a twig template file it is empty

    {{ node.embedded_view }}

What is wrong with my code. How can I render a view and set it as a content of node or just node field in order to print it in a twig template file.


texts: remove all HTML when embedding blocks in node template

texts:
I'm embedding two blocks inside a node using something like:

<?php

 $block = block_load('views', 'principles-block');
 $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
 print $output;

?>

My problem is that $output comes with a whole bunch of html tags and css classes that I wish to completely remove.

Principles

Configure

I just want to print the fields in plain text and be able to add HTML tags and CSS classes that I choose in the template. Is this possible? I've tried Fences and Semantic Views with no success.


texts:
As part of some other functionality I am generating an image in temp folder and But unforunately I'm not able get the web url of image.

$path = \Drupal::service('file_system')->realpath(file_default_scheme() . "://");
$image_path = $path . rand() . '.png';
echo $image_path;

I am getting following as path

C:\wamp\www\www_d8test1_com\sites\default\files30605.png

How can I add slash before image name and get actual weburl of image like below?

http://www.d8test1.com/sites/default/files/30605.png


texts: Let users download entire folders (zip first) or individual files?

texts:
Is there a module or a series of modules that will allow users to download a folder of files (e.g. construction blueprints and sketches) or just individual files via the browser?

The files for user A should be only accessible to user A.


texts: Have Views based Taxonomy Term page use term description for title

texts: I am using a view to replace the standard Taxonomy Term page (turned on the standard one in Drupal 8.x). I want the Title of the page to be changed from the Name of the term to the Description of the term everywhere it appears, in the Title attribute in the Header but more importantly in the Title that is rendered on the page. I have tried all sorts of tricks in a custom page--taxonomy.html.twig file to no avail.


texts: How to overwrite Paragraphs Item on subpages?

texts:
I am using a couple of Drupal Paragraphs Items in full-size edge-to-edge view with Bootrap’s container class. It’s working great.

I’ve applied a container class to paragraphs-item--service.tpl.php

However how can I overwrite the paragraph item on a subpage that uses a 2 column layout?


texts: unable to set CONTEXTUAL FILTERS according to Raw Value from Url

texts:
In my project having two type of Content Type 1) Artist and 2) Work

I have added the content for the Artist and now also i have added  the content for the Work according to Artist Name having field name (Artist field_artist    Entity reference)

On view Page i want to show the result according to the artist

http://localhost/drupal8/artists-works/robert

According to name robert i have set the CONTEXTUAL FILTERS and Relationship.but its not showing any result
when removed the filter its showing all the work content type type
How can I set CONTEXTUAL FILTERS and Relationship according to this


texts: How to programmatically create node with image file saved from remote source?

texts:
I have a remote image URL address saved in $image_url variable and the following code to programmatically create a node:

  $node = new stdClass();
  $node->uid      = '1';
  $node->type     = 'article';
  node_object_prepare($node);
  $node->title    = $title;
  $node->status   = 1;
  $node->promote  = 0;
  $node->sticky   = 0;
  $node->language = 'ru';
  $node->body['und'][0]['value']   = $body;
  $node->body['und'][0]['format']  = 'filtered_html';
  node_save($node);

Calling filefield_sources_save_file($image_url) in a custom module gives:

  Warning: filesize(): stat failed for http://www.remotesite.com/images/2014/11/1414790760.jpg in filefield_sources_save_file() (line 451 of /home/mysite/public_html/sites/all/modules/filefield_sources/filefield_sources.module).
  The specified file 1414790760.jpg could not be uploaded. Only files with the following extensions are allowed: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp.

Could you please help me to make changes into above peace of code to programmatically create a node with the image in the imagefield saved from a remote source.


texts: Function to determine whether my Cart is empty?

texts:
I want to set an access callback on a menu item (primary links) for the shopping cart so that it only displays when there is something in the cart.  However, I can't find an obvious function to to this, and I don't know where to start with my own code.

Any suggestion is appreciated.


texts: How to get the view fields in rows in the word document generated using Views data export module?

texts:
I am using Views data export module (version 7.x-3.1) to download content in Microsoft Word Format.

I am able to download the content but the fields of the view are coming out in columns rather than rows.

Please guide.


texts: White screen error when migrating between servers

texts:
I wish to migrate my site from one shared hosting server to another. Both servers are with the same company (Heart Internet). I moved the files to the new server, set up a new database on the server, replaced the old settings.php with the contents of default.settings.php to get a default draupal installation up and running.

Trying to migrate the database using either the backup and migrate module or importing the database via phpMyAdmin I get a white screen error on the site i am migrating to.

I have looked up some possible causes and based on what I have read I have:

Disabled Devel modules
Disabled Clean URLS

I found this helpful page on troubleshooting white screen on death in drupal which recommends adding code to the index.php to get information on the problem.

Following the instructions given there gave me the following error description:

Fatal error: Call to undefined function _date_api_element_info() in /home/sites/MY_DOMAINNAME.co.uk/public_html/sites/all/modules/date/date_api/date_api.module on line 2298

Based on this I assumed that the date module was causing the problem I disabled the date module on the original site and rolled the new site back to the basic Drupal install and imported the most recent databased backup. However I am still getting the same error message.

Both servers are set to execute scripts as PHP 5.3

I can appreciate that this is not an easily issue to reproduce. I would like suggestions as to sensible next steps to try to stop this error from occurring and complete the site migration successfully.


texts:
Is there a module that provide a base/framework for simpler/faster rendering of a view(in MVC terms).. a function like

  render_tpl('path/to/my/tpl/myview.tpl, array('var1'=>$var1,
  'var2'=>$var2);

?
You see something much simpler than having to declare my theme to the theme registry via hook_theme etc... (sometimes it seems overkill just to render a simple layout)


texts: Get the values of a checkbox field in node when evaluating in block condition plugin

texts:
I have a field that is a checkbox with multiple values... I'm trying to do an evaluation in a condition plugin where I'm checking against the checked values. For a boolean field, the syntax is:

$value = $this->getContextValue('node')->field_news_filter_menus->value;

Since field_news_filter_menus is a checkboxes field, I need to get the array of checked values.
These all return null:
$this->getContextValue('node')->field_news_filter_menus->list->values;
$this->getContextValue('node')->field_news_filter_menus->values;
$this->getContextValue('node')->field_news_filter_menus->list;

PHPstorm xdebug says the path is $this->getContextValue('node')->field_news_filter_menus->list[0]->value;
But null is returned for that also.
I can see the values in xdebug that follow a path as $this->getContextValue('node')->field_news_filter_menus->list[0]->values and see an expected value, but that path also returns null.

What is the syntax for getting that array list?


texts: What is the difference between DRUPAL_ROOT and file_directory_path() in drupal 6?

texts:
I want an alternative for file_directory_path() deprecated in Drupal 7. I got an alternative with file_default_schema().

What is the difference between DRUPAL_ROOT and file_directory_path() or
DRUPAL_ROOT and file_default_schema()?


texts: Add Additional Submission Processing To "Create Node" forms

texts:
Which hooks can I implement in Drupal 7 to add additional processing steps to the node creation process.  For example, to run a snippet of PHP code after the node has been successfully saved to the database.  I'm assuming hook_form_alter, but I only want to add to the process, not replace the default node save process.

Specifically, I'm looking to make an immediate external API call to SmugMug.com and then trigger an email upon a successful node save.


texts: Execute command line script in module file

texts:
I am using Drupal 8.9.5 and I need to compile a SCSS file using Gulp command in our module file.
If I execute the command from the command prompt, it works without any issues, but when I tried from the module, it didn't work. I have tried with shell_exec() and exec().
The theme path is C:\wamp64\www\drupal895\themes\customtheme. Inside that directory, I have the node_modules directory, the package.json and gulpfile.js files. I am trying to use the following code.
echo shell_exec('gulp');

Can anybody help me?


texts: How can I make variations selectable in the cart?

texts:
Is it possible to have variations selectable in cart in D8 Commerce 2?
For example I would like to change the color of a T-shirt from blue to green in the cart? Right now I only seem to be able to show the value of a variation, not make it selectable.


texts: Is there a solution which could keep information about actions and updating of data on the site?

texts:
For example, there is a site. And it's necessary to create a news feed on the site. Approximately, like on the Facebook.

Thas is, if someone added a new forum topic, article or page of another content type, this event should be added to the news feed. Also if someone changed any page, information about it also should be added to the news feed. Also, if someone commented or liked something. Also if a new used added to the site. And so on.

I need to clarify, is there a solution, which could perform it ? And this solution should have opportunity to customize, which data should be added to the news feed and which data shouldn't. And I need to have possibility to customize its output design.

I don't want to try to use the dblog module for it. Moreover, the data on the dblog module can be deleted.

P.S. In my opinion, it's not possible to perform it using the views module only. Because views doesn't allow to use different types of entity, such as nodes, comments, users and so on in the same view. Therefore, I see the way to put it together using some entity, which keeps information about actions and which can be outputed using views.


texts: How do I install with PostgreSQL using Docksal?

texts:
I use Docksal for developing on Drupal. Recently, I decided to install Drupal 9 with PostgreSQL as a database using Docksal.
Firstly, I cloned https://github.com/docksal/boilerplate-drupal9. Then, I modified some files accordingly to https://github.com/docksal/docksal/issues/193#issuecomment-376343111. Lastly, I ran fin init and this error message.

[warning] Failed to drop or create the database. Do it yourself before installing.
ERROR 2002 (HY000): Can't connect to MySQL server on 'db' (115)
[notice] Starting Drupal installation. This takes a while.

Frankly speaking, I can't understand what does MySQL has to do with it?
The database driver should be PostgreSQL and the default database should be also PostgreSQL.
Has anybody encountered this problem?
Is it possible to install Drupal 9 on PostgreSQL via the Docksal service?


texts: How can I show the latest added content to a specific link?

texts:
I have content type Videos, lets say I have 5 videos, they have these url links:

/videos/video-name-1
/videos/video-name-2
/videos/video-name-3
/videos/video-name-4
/videos/video-name-5

What I want is when I go to /videos I want this page to show the last video added (/videos/video-name-5) and I want to make this dynamic e.g. if I add a new video, when I visit /videos it will show me the page of that new video I added.

How can I achive this? As much as possible I don't want to use redirect.


texts: How to build an url to access filtered view?

texts:
From a first view I need to dynamically build an URL to add a link to another filtered view named gallery_details.
I created a tpl template for my view where I build the URL like this one:

  http://www.example.org/?q=gallery-details&field_main_categorie_value=Anciens&field_categorie_value=dessin&page=2

where field_main_categorie and field_categorie are the two used filters.
When the two filters are "exposed" it works, but if I uncheck the exposed filters, this URL become invalid.
I don't want to let the user to directly select the filters on gallery_details, also a solution may be to hide the exposed filters in gallery_details view.

I guess that there is a better solution.


texts: Responsive/Fluid Views for Responsive/Fluid Website

texts:
I an creating a Responsive/Fluid website with Drupal. Everything is great, expect when I create a view with the view module, I cannot the view to become responsive/fluid like other images I have on the site.

What I have tried is to make the .views-field-field-images width 100%, which should make the image with in views responsive. However no luck!

Any help?


texts: Receive error message for radio buttons ."An illegal choice has been detected. Please contact the site administrator."

texts:
I have created a multi step form, in which I have added radio buttons dynamically by using data from the database. The radio buttons added here are not required. But still I get the following error. I have created a custom module.

  An illegal choice has been detected. Please contact the site
  administrator.

Kindly help me resolve this issue. This is not a duplicate issue. Other issues listed have mentioned that the radios button are used as required field in that case.
Please find the code added :

$opt = array(
        'f' => 'Friend or Business Associate',
        'b' => 'Brochure',
        'c' => 'Company',
        'a' => 'Another Columbia Asia Hospital',
        'ad' => 'Advertisement',
        'an' => 'Another Doctor',

);
$step1['questions']['learn_abt'] = array (
        '#type' => 'radios',
        '#title' => t ( 'In How did you first learn about the Hospital' ),
        '#options' => $opt,

);


texts: multi price in drupal commerce in drupal 7

texts:
I have a shop created with drupal commerece modules,I enabled 2 currency in my shop , but only show one of them, I want to show price in 2 currency

something like this
price :  10$  / 20 IRR
I use multi currency module to achieve this job, but  I my problem is in payment  phase,
I use multi currency module to achieve this job,in multicurrency  module's setting I don't want  use  synchronize method, if you want have two field in my product , one form $ and another for IRR, I did this job by this method

first enable IRR currency in
 admin/commerce/config/currency
 then in
 admin/commerce/config/currency/handling
under Enable dedicated price fields for Product check Iranian Rial
 by doing this  another field added you my product ( ** Price for IRR** ), this is good , after this I enable  *currency selector * block ,in checking out process by switching the currency I don't see any change in current currency of billing and cart. :(
why changing currency not changing cart currency?


texts:
How to change or update select list of field which is already filled with values.
When I try to remove or edit value the options, I got:
"Allowed values list: some values are being removed while currently in use."


texts: How do I fetch versions of a module compatible with latest core version?

texts:
I've been using the endpoint https://updates.drupal.org/release-history/[module]/[version], where [module] is the module name and [version] is its version (as 8.x or 7.x). This endpoint, however, doesn't work for 9.x.

For example https://updates.drupal.org/release-history/search_api_solr/8.x works fine but https://updates.drupal.org/release-history/search_api_solr/9.x has nothing, although the module has releases compatible with Drupal 9.

Also, the endpoint for 8.x doesn't return new releases in SEMVER format.

How can I get module releases for Drupal 9? Why aren't SEMVER releases  included?


texts:
I have created a simple module to display frequently asked questions (FAQ). The output (faq content) can be customize in mymodule-template.tpl.php file located in a module directory.

I'd like to create an additional template file suggestion for the theme directory e.g: sites/all/themes/mytheme/templates/mymodule-template.tpl.php

So, the main goal is to add two template file suggestions.

[my module path]/mymodule-template.tpl.php
[active theme path]/templates/mymodule-template.tpl.php

To achieve #1 I have implemented this hook.

/**
 * Implements hook_theme()
 * @return
 *  An array with the name of template file and variables
 */
function simple_faq_theme($existing, $type, $theme, $path) {
    // get faq content
    $records     = get_faq_content();   // categories, questions, answers
    $description = get_faq_info('intro');   // faq description

    return array(
        'faq_template'  => array(
          'template'    => 'simple_faq',
          'variables'   => array('records' => $records, 'description' => $description),
        )
    );
}

/**
 * FAQ Page content
 *
 * @return
 *  HTML created by template file
 */
function simple_faq_page() {
    return theme('faq_template');
}

It works, but I can't figure out how to create an additional suggestion, which allows users to theme the output without changing anything within module files.

Any idea?


texts: I am unable to install module for my Drupal 7

texts:
I am a newbie to Drupal and was trying to develop a website. I am in need of modules to enhance and when trying to install them , it throws the following error.

  Warning: ftp_login(): Login incorrect. in FileTransferFTPExtension->connect() (line 59 of ..)
  Check Username and Password

My username and password are perfect. Can someone please help??


texts: Create a Node with Fields and turn them into tabs in a display?

texts:
I am a Drupal 7 newbie, I am only proficient in CSS and HTML and I am looking for someone to point me in the right direction(to documentation/modules/advice) on how to execute what I am trying to do or even telling me if it is possible or not.

I tried making tabs already, I was using quick tabs and multiple blocks but I found that would be inefficient because I need 12 pages with tabs and each has at least 2-3 tabs with content each that need to be eventually edited by heads of departments.

What I am trying to do:

Create a page with multiple tabs and content inside of it.
When editing the node there should be multiple tabs at the top corresponding with the tabs on the page and an option to add more tabs up to a limit
Tabs should have a title and body field.

Some examples of the content of the tabs: welcome, about, programme. They would just have 1 or two paragraphs of content.

How I was thinking it could be done:

Creating a New Field type called Tab, that groups a title & body
Creating a New Structure type that has max of 6 Tabs
Create a new display to have the fields organized into tabs.
Download Module for displaying tabs in editing mode?

I just don't know how to make that possible or if it is. Can someone point me in the right direction or help me to come up with a better alternative?


texts: Hyphenated nodeName or DTD nested in XML causes Feeds XPath Parser failure

texts:
I am using Feeds and Feeds XPath Parser.

I have an XML source like this.

<xml>
  <records>
    <record>
      <EAC-CPF xmlns:eac="http://jefferson.village.virginia.edu/eac" xmlns:edit="http://nla.gov.au/nla.party" xml:id="_cb2bf3c2-b54c-42c3-a890-048c06549e45#10" xsi:schemaLocation="urn:isbn:1-931666-33-4 http://eac.staatsbibliothek-berlin.de/schema/cpf.xsd">
        <cpfDescription>
          <identity>...</identity>
        </cpfDescription>
      </EAC-CPF>
    </record>
  </records>
</xml>

Which I am trying to import with field settings like

EAC-CPF/cpfDescription/identity/...

With debugging turned on I can see that fields outside of the EAC-CPF node are correctly found whereas those within are not. I've tried various escaping of EAC-CPF but I'm wondering if its a limitation of XPath in PHP or the Parser module. Or is it the nested namespace and schema?


texts: Triage / decision tree / simple guided entry / expert system for Drupal 8?

texts:
Is there a Drupal 8 module or technique for asking a series of screening questions of visitors, and then spitting out a computed response? This might be called a guided interview, expert system, intake triage, or decision tree.

Specifically, we have client eligibility guidelines. I'd like a visitor to be able to put in their zip code, household size, and income to determine if they meet those guidelines. Ideally they get the result on the same page without hitting submit.

I have located this: https://bdsworks.org/triage-text-doc which is not for Drupal 8. I also read this previous result: Module for decision tree / guided entry. Hierarchical select looked promising, but I don't think it's quite the same thing I'm trying to do.

I also checked out the webform module, but it looks like the conditional logic isn't really aimed at this use. E.g., when testing against a specific value, there's no ability to test for presence in a list of multiple entries (like one of dozens of zip codes) or a range of numeric values.

Maybe this isn't as common a need as I thought?