texts: How can I change the "Edit" tab name to something more meaningful?

texts:
I would like to change the Edit tab from Edit to Edit Client.  The content type is Client.

I tried using the following code in the bartik.theme file in the web/core/themes directory (running drupal 8.5.4).

function bartik_preprocess_menu_local_task(&$variables) {
  if (isset($variables['element']['#link']['title']) && $variables['element']['#link']['title'] == 'Edit') {
    $node = \Drupal::request()->attributes->get('node');
    if ($node && $node->getType() == 'client') {
      $variables['link']['#title'] = t('Edit Client');
    }
  }
}


texts: CKeditor is not working with jquery > 1.8

texts:
I'm trying to get superfish accordion working on my pages. I have to have my jquery_update set to 1.9 or greater to get that function working.

But when I do I lose ckeditor on the comment fields for things like forums and such. I'm not sure what to do to resolve this problem.

Currently running Drupal 7.53

CKEditor for Drupal module 7.x-1.17

Superfish menu module 7.x-2.0


texts: View using "Display links" not showing links when teaser view mode is used

texts:
I have the following format setting in my view:

This doesn't work when the "View mode" is "Teaser", but works fine when it's set to "Full content".

There is a custom template file for this node type, but it contains the standard

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

Anyone know what the root cause might be?


texts: template to add a h2 tag around a field group title

texts:
I have a field group in my content type. I want to wrap an h2 tag around the title of the field group. I have tried looking at the node.tpl.php and field.tpl.php for a way to wrap just the title, and have not succeeded.

Where can I target this?


texts: Create a responsive email at Drupal for phone

texts:
does anyone successfully create a responsive email at drupal? I mean, with @media rule, but not just using width percentage(like 100%) to control element width.

We got one request to build two different email styles for pc and phone. We need different font size and different element width for this email. Now the email for pc is done, but I can't figure out an appropriate way to do the email for phone. I tried @media rule in css, but the @media rule will overwrite the regular css rule in pc too.

I sense it might be the reason that I have converted css class to inline css, so media rule is not working. However, inline css in email is recommended to meet most of the email clients out there, and I see the good email, like email from linkedin, uses the inline css too. The email from linkedin displays differently in phone and works perfect as an example of responsive email, having smaller image size, font size, element width and so on.

I tried this email template from this article https://www.emailonacid.com/blog/details/C13/emailology_a_free_responsive_email_template_using_media_queries_-_part_i# It doesn't work for me. The email at phone email client looks the same way as the email showing at pc. Not sure why this email template works for others, but not for me, or not for drupal?

For the record, I'm using mimeemail in Drupal6 and writing the code to send email directly.

Does anyone has idea to solve this issue? Any help will be appreciated, thanks!


texts:
I am in the process of upgrading a Drupal install from 6 to 7. Drupal 6 uses the ckeditor module without any difficulties.

As I upgraded to Drupal 7 and the latest version of ckeditor, the module no longer works.

Firebug gives me an error message:

Failed to load resource: the server responded with a status of 404 (Not Found) http://mysite/ckeditor.js?mcqjp7

I'm not sure why ckeditor is looking in the site room for that file.

It has no trouble finding the css file

<style type="text/css" media="all">@import url("http://mysite/cms/sites/all/modules/ckeditor/ckeditor.css?mcqjp7");

So why can it find the CSS file but not the JS file?


texts: Node content links block for creating content not showing up for certain roles

texts:
I'm having an issue with the "node content links" block I created to contain my node content links -- i.e., links that allow a user to create content -- not showing up for the users it's supposed to show up for. I've done a lot of research on this and still can't figure out what's going on. I'm using the Entityreference Prepopulate module in conjunction with Organic Groups to create a link that users can click on to create artcles that are then posted within the appropriate group.

It works perfectly for the admin role, but when I give authenticated users permission to create content, the block doesn't show up for them. I've made sure in the manage fields screen of the relevant content type (i.e., "Group Content") that everything looks OK (Groups Audience has an Entity Reference field type, the widget is "OG Reference", and I'm pretty sure the settings on each are sound, though I may have done something wrong so I'd be grateful if someone could tell me about any commonly made mistakes during this configuration step).

In the Permissions area (both the regular permissions and the permissions set aside for organic groups) everything looks fine, i.e., both the admin role and authenticated user role can create Group Content content as well as Group content, etc.

Then, on the block configuration page under "Roles," I've check-marked "authenticated user" and "administrator."

Can anyone tell me what I'm doing wrong?


texts: Best way to get module and commit meta data from drupal.org

texts:
This is a broader question, but related to: get-more-drupal-org-project-usage-information

Goal: I'd like to get richer stats about modules.

Choosing a module has become a very complicated process.  Things like recent commits, usage growth/decline, number of maintainers, etc. all factor in but drupal.org has (frankly) lousy tools for finding modules and http://drupalmodules.com/ is basically abandoned.

Current Approach: Screen-scrape limited available stats like https://www.drupal.org/project/usage

I've been grabbing some stats to help me make an informed decision but scraping seems archaic given the openness of drupal.

Ideal Approach: Use published drupal.org API to query in JSON

Does such a thing exist to harvest module info or is it necessary to scrape?  Even better would be to create a database or spreadsheet.

I have seen a thread discussing this, but looking for an implementation or concrete plan to implement.

IMO there is a desperate need to improve module transparency and data to help system builders better select appropriate modules.


texts:
I have a custom content type "Project" which has two fields "Completed Projects" and "WIP Projects". I have added some of my project as completed and rest of them are wip.

Using webform, I wanted to create a form, which can show ONLY my WIP projects (Not completed projects) in check box option. So that check box entries can be generated dynamically and user can select WIP projects.


texts: hook_form_alter() to put multiple radios in a table

texts:
I have a content type that has a series of multi-value select fields. That I need users to select in relation to a value pulled from another node.

The best way to present this is to have a table that looks like this:

I've got the 'bones' of a hook_form_alter, and I can almost present what I need. However, I cannot seem to get my checkboxes/radios to appear in the grid. I am this far...

My form_alter function looks like:

function hnbuilder_form_node_scheme_of_work_form_alter(&$form, FormStateInterface &$form_state, &$form_id){
/** check whether we passed a node reference into the form via ID in the url **/
if ($_GET['id']){
    $nid = $_GET['id'];
    /** if we didn't pass it in, we are editing the node **/
}else{
    $current_url = Url::fromRoute('<current>');
    $path = $current_url->getInternalPath();
    $path_args = explode('/', $path);
    $thisnid = $path_args[1];
    $thisnode = \Drupal\node\Entity\Node::load($thisnid);
    $nid = $thisnode->get('field_related_unit')->target_id;
}
/** Load the referenced node */
$node = \Drupal\node\Entity\Node::load($nid);

/** get the learning outcomes from the referenced node
    and put them into an array **/
$lo = array(
    0=>"",
    1=>"LO1 ".$node->field_lo1->value,
    2=>"LO2 ".$node->field_lo2->value,
    3=>"LO3 ".$node->field_lo3->value,
    4=>"LO4 ".$node->field_lo4->value
);

/** create table headers **//
$header = array(
    0 => 'Learning Outcome',
    1 => 'Assignment 1',
    2 => 'Assignment 2',
    3 => 'Assignment 3',
    4 => 'Assignment 4'
);

/** an array of the checkbox/radio options from our content type
    each field has 4 options
*/

$ffld = array(
    1=>$form['field_lo1_sow']['widget']['#options'],
    2=>$form['field_lo2_sow']['widget']['#options'],
    3=>$form['field_lo3_sow']['widget']['#options'],
    4=>$form['field_lo4_sow']['widget']['#options']
);

/** create a new array of options for the table
    */

$options = array(
    1=>array($lo[1],$ffld[1][1],$ffld[1][2],$ffld[1][3],$ffld[1][4]),
    2=>array($lo[2],$ffld[2][1],$ffld[2][2],$ffld[2][3],$ffld[2][4]),
    3=>array($lo[3],$ffld[3][1],$ffld[3][2],$ffld[3][3],$ffld[3][4]),
    4=>array($lo[4],$ffld[4][1],$ffld[4][2],$ffld[4][3],$ffld[4][4])
);

/** build the tableselect **/
$form['table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#js_select' => FALSE
    );

return $form;

}

I think I have several issues, and I'm hoping someone can help:

I'm not sure that 'tableselect' is the right thing to be using, as it seems this only supports single selection (based on the table row).
I'm unsure how to display the existing checkbox/radios as actual field items. I'm stuck getting their values.

Is there a way to achieve this? If so, I'd really appreciate some pointers.


texts: How to programmatically add image from external URL using media module?

texts: I want to programmatically add an image from an external URL and have the module store and display a local copy of the image. How can I do that? Normally, I would click the "select media" button while creating a new node but I want to do it through code.


texts: Cron job run, but module updates not checked - how to automate?

texts:
I configured a script to run as part of my cron.daily tasks, and tested the script.

My status report says that the cron was correctly run by the script, so I'm happy that that will happen.

However, I went to the available updates page, and it still says that I last checked 17 hours ago - isn't this part of the cron?

Is there a way I can include this in the automated checks and reporting?


texts: How can I load a block's subject and body, programmatically, for use in a module?

texts:
I need to create an array in my custom module that contains data from multiple blocks.  something like this:

array(
  'block_1' => array(
    'subject'=>'Block Subject Here',
    'body'=>'Full block body html here',
  ),

  'custom_module_block' => array(
    'subject'=>'Block Subject Here',
    'body'=>'Full block body html here',
  ),

  'another_block_machinename' => array(
    'subject'=>'Block Subject Here',
    'body'=>'Full block body html here',
  ),
);

In order to do this, i need to be able to programmatically load block content, being able to access and handle each block's subject and body in order to populate my array.

Imagine the node equivalent being a simple node_load(); where you can easily access $node->title and $node->body from within the loaded node.

I'm not able to find any functions that make loading this block data possible.  Neither block_load() nor module_invoke() get me all the data I need (specifically the block subject).

So, how do I load a block's subject and body programmatically so I can use it in my custom module?


texts: Is it possible to change fieldset title if collapsed with #states

texts:
I'm trying to use #states in form api to change the title of a fieldset based on his collapsed states.

so far here's my code :

$form['advanced'] = array(
  '#type' => 'fieldset',
  '#title' => t('Advanced search'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#attributes' => array('class' => array('search-advanced', 'clearfix')),
  '#states' => array(
    '#title' => array(
      array('fieldset#edit-advanced' => array('#collapsed' => 'Hide advanced search')),
    ),
  ),
);

I've tried different things, but without success.

Thanks a lot.


texts: how is config saved in nodeapi_example module?

texts:
In this module, which hook is responsible for saving the user choice (at admin/structure/types/manage/<CONTENT_TYPE>) into the database?

I implemented nodeapi_example_form_alter() function exactly as it is, but it is not saving anything.

My hook_form_FORM_ID_alter() in my .module - this does NOT save the value of my radio - anything missing here?

function followbtn_form_node_type_form_alter(&$form, $form_state, $form_id) {
  // First, check for the node type configuration form.
  drupal_set_message('Entered hook_form_alter ...');
  //if ($form_id == 'node_type_form') {
  if (isset ($form['type'])) {
    // Alter the node type's configuration form to add our setting. We don't
    // need to worry about saving this value back to the variable, the form
    // we're altering will do it for us.
    $form['followbtn_rating'] = array(
      '#type' => 'fieldset',
      '#title' => t('Custom Rating settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'additional_settings',
      '#weight' => -1,
    );

    $form['followbtn_rating']['followbtn_node_type'] = array(
      '#type' => 'radios',
      '#title' => t('NodeAPI Example Rating - Custom'),
      '#default_value' => variable_get('followbtn_default_mode_' . $form['#node_type']->type, FALSE),
      '#options' => array(
        FALSE => t('Disabled'),
        TRUE => t('Enabled')
      ),
      '#description' => t('Should this node have a rating attached to it?'),
    );
  }
}

I can see the "Enabled" and "Disabled" radio buttons; when I hit "save Content Type", these do not get saved.


texts: Add User Edit and Profile pages to Quicktabs

texts:
I'm using the module Quicktabs on my user pages.

As you can see here I now have 2 rows of tabs and would like to move the User Edit and Profile to the Quicktabs tabs.  However the options of block, view, node, qtabs and callback don't seem to cover these pages.

Has anyone else got around this problem.

thanks in advance


texts: How can I add a playlist to content type?

texts:
I need to add a playlist of mp3 or waves to custom content type. I installed some modules, but nothing seems to work:

I installed audiofield that allows upload of files.
I installed some plugins, such as wordpress player, but it isn't accessible to screen readers (flash buttons are unlabeled).
I installed jPlayer, but there are many errors when I attempt to display content, such as undefined index.continuous, undefined index.entity etc.
I installed able player, an accessible able player, but tracks are not visible.
I try to install jw_player, but it doesn't install due an error index.description undefined.
I tried to set file field as an audio file, but track are not visible.
I tried to change theme, switched to bootstrap instead of bartik, but nothing change.

I don't know how to do. Is Drupal able to play audio files?


texts: How to place custom module template file in theme folder

texts:
I am using Drupal 6, and I have created a custom module which is in the  "sites\all\modules\custom" folder; in the same folder there is also the custom.tpl.php file.

I want to place the custom.tpl.php file in the theme folder.

Here is my code:

function custom_menu() {
  $items = array();

  $items['custom'] = array(
    'page callback' => 'custom_page',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function custom_page() {
  $result = db_query('SELECT * from node');
  return theme('custom', array('output' => $result));
}

function custom_theme() {
  return array(
    'custom' => array(
      'arguments' => array('output' => NULL),
      'template' => 'custom',
     ),
  );
}

function template_preprocess_custom(&$variables) {}


texts: latest zen theme make the admin drop menu failed to work

texts:
I am using the zen 7.5x, however when I tried it, the dropmenu for the admin doesn't work any more.

any one know how to solve this, is this because of javascript side?


texts: Fields for different languages on the same interface

texts:
I have a node that has many fields but need only the title and body field translated.

This node type has a workflow associated to it and any authenticated user can create that node.

The client requires that fields for language EN/FR are all available on the form

I'm wondering what is the best approach to adopt:
content translation + different fields for each language
or
Entity field translation

I've tried entity field translation but it does not provide the fields for each language on the same interface and it does not seem to work well with workbench moderation.


texts: Is it possible to have all content types as dropdown field in one content type in drupal 7?

texts:
I have one requirement, where I need to create one content type having field 'Type' and it should have Dropdown list of content type present in that Drupal project.
Is it possible to do it? Can anybody suggest me how can I achieve this?


texts: Set up site where only theme and contributed modules are under git version control

texts:
I'm working on a site for a large organization where they host a git repository for the code.  But that doesn’t include a copy of Drupal (the core).  Their repo has modules and themes directories, files directory, and a few other script files.

So for development I have another completely separate local copy of the site running.  What I’m going to run into is -

develop in my local code, then
try to remember what files I changed & copy them over to the repository..
add, commit & push to develop branch

Is there some magical way that I can install Drupal in a directory outside the repository, but for the theme and contributed modules, point to the directories in the repository?

This is on a Mac.


texts:
I am creating a new registration form with the Fields UI module and need to
be able to add variable_get instances for username, email, etc and also add
select lists for birthday info, typical drop downs like range(1,12), range(1,31),
and range(2015,2012). I'm having trouble trying to figure out how to do this,
or how to put preset variables into my fields. Can I dump this and edit it
myself, or can I put in what I need?

EDIT

I found out that I can use list(int) then select widget type select list to create
select boxes, BUT I still cannot assign things known variables.

To further this along, lets say I have I have $variables['bio']['firstName'], I
am trying to assign name_bio_firstName to the field for name, if that doesn't confuse
anyone more.


texts: What to do in a case of plugin ID not found?

texts:
I'm fairly new to Drupal, the inside settings are quite easily to understand for me but when it gets to error fixing I'm kind getting stuck sometimes.

For a project I've installed the Open Social platform as my Drupal, which is working fine but a couple bugs and things for me to find out. I wanted a file browser as a Knowledge Base into my site so I've installed the FileBrowser module.

Now when I want to specify (open social) group rights to a file browser node, so only that group can look into this file browser, I get the following error and I cannot seem to find out where to solve it:

Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException: Plugin ID 'group_node:dir_listing' was not found.

Could anyone point me into the right direction?


texts: Create a list of figures, equations and other items

texts: I run a website that is like an electronic book http://www.pveducation.org Presently there are equations, images, mini-calculators that are included in the body of each page. How do I get Drupal to automatically create a list of links to,for example, the equations?  I also thought of making the equations a Content Type and use Views to make a page of all the equations but then I can't figure out how to use the new type in the body of each page. Should I use entities instead?


texts:
I have installed the latest version 7.x-2.11
And after selecting the option "nomousezoom : Disable mouse zoom".

I can still scroll over the map using my mouse.

Is this a known bug? is there a patch and if so how do I use it?


texts: RULES : How to redirect user to a page after login unless they're using the one-time-login-url?

texts:
I created a rule to redirect users to the front page after they login.
It works fine

The problem is when a user uses the link received on his email to choose a new password, or after clicking on the link to validate their signup, they're also forced redirected to the front page instead of heading to their user page to choose a password (in the case of a forgotten password) or finish their profile setup (after clicking on the link to validate their registration)

Any ideas on how to fix this ?


texts: Utilizing admin panel values elsewhere in a module

texts:
So I've got a custom admin panel page in a module I've written, and I want to get a value out of it.

Let's say I have a text box on this admin page, with a value, and I want to get that at some other point.

Do I need to use variable_set and put that into the database and then variable_get it in the function I want to use it in - or do I call it some other way?

Basically this thread:

https://drupal.org/node/2074589

Essentially, I just want to have a user be able to select a picklist value in the admin, and then call that picklist value later on in the actual module, for display.


texts: How to display the blocks to display in certain page in Drupal?

texts:
Consider a module deserts:

page1:- deserts/*
page2:- deserts/*/*
page3:- deserts/*/*/*

A dynamic content ...

I have three blocks, namely a,b and c:

Block a should be displayed only in page1
Block b should be displayed only in page2
Block a should be displayed only in page3

How should do that restriction?


texts: how to find whether a node has more than one revision?

texts:
How could I find whether a node has more than one revision. I use node_load($nid) and get a $node object.
How can I achieve this using the object? What would be the best way to do it?


texts: Views Field Show "NEW" if less than 1 day old

texts:
I am displaying webform submissions in a view, and need to add a "NEW" notification if the submission is less than a day old.

I have created views-view-field--myfield.tpl.php and have managed to change the value of my field using the template.

I am grabbing the submitted date, which I have printed already to make sure it works, and it comes up as 13/05/2014 - 23:13

I am then trying to figure out how to return a value for a date that is less than 1 day old. I'm pretty sure the following should do it, but it always renders "not new".

<?php
$submitted = $view->style_plugin->rendered_fields[$view->row_index]['submitted'];

if( $submitted > strtotime('-1 day') ) {
  echo '
NEW!
';
}
  else
{
  echo 'not new';
}
 ?>

Can anyone see where I'm going wrong?

UPDATE:

So, this works...

if( strtotime('14 May 2014') > strtotime('-1 day')) {
  echo '
NEW!
';
}
else
{
echo 'nothing
';
}

If i set it to 14th may (today) Its shows up as NEW! , any earlier, it prints nothing.

So, this leads me to believe there is a problem with my submitted date.

But, If I put echo $submitted; i get 13/05/2014 - 23:13

If I put $newDate = date("d M Y", strtotime($submitted)); echo $newDate; i get 01 Jan 1970 for every result.

And If I put $newDate = date("d M Y", $submitted); echo $newDate; I also get 01 Jan 1970 for every result.

So now I don't know what's going on. If its not in timestamp format, strtotime should sort it shouldnt it?


texts: Using Webform Hooks to submit and display custom module forms?

texts: So i created my custom module form and submit handler...then realized i needed to use Webform hooks to save and hopefully view. Basically i wish for webform to manage the heavy lifting by taking care of the save and submissions.. also is it possible to save the values from the form as nodes or send them as emails? please any help is appreciated iv been staring at the webform API for days..


texts:
I have installed Print module and also TCPDF library to generate PDF files. However, Print module can just create PDF files to download, but not to save in server folder. I have tried to change method _print_pdf_tcpdf in Print module, so files can be saved in server folder. I have changed _print_pdf_tcpdf function  as follows:

I have changed line

$pdf->Output($filename, $output_dest);

to this line:

$pdf->Output($filename, 'F');

But this code throws error:

TCPDF ERROR: Unable to create output file: https://mywebsite/sites/default/files/aaa.pdf

I have set permissions for sites folder to write. Another modules can write into this folder, so I dont think the problem is in permissions.
Can anybody help
where can be problem?


texts: Add markup inside a link (in the renderable array) in preprocess field

texts:
My question is for D8...

I have a field which is rendered as a link. Let say for simplicity that it will be rendered like this: My Title

I would like to add a bootstrap icon inside the link to get a result like this: My Title

I know that I can take the url and the title from within the preprocess function to reconstruct a new link (#markup)... But is it possible to simply add the icon code somewhere in the array to get the same result?

I am adding some more information to clarify:

1-The field which is rendered as a link is a term reference field rendered as a linked label

2-Here is my try in the preprocess_field function to achieve this

function mymodule_preprocess_field(&$vars) {
  $fn = $vars['element']['#field_name'];
  switch ($fn) {
    case 'my_field':
      foreach ($vars['items'] as $key => $item) {
        $icon = '';
        $vars['items'][0]['content']['#title']=$icon.$item['content']['#title'];
      }
      break;
  }
}


texts: Any performance impact or reason to delete unused views?

texts:
I have maybe 250 views on a site build and estimate that I use around 150 of them.

Is it ok to leave the extras there unused? It would take days trying to guarantee views aren't being used in custom blocks and in hooks for other views.


texts: Custom user field not showing up for view except for site Administrator

texts:
I have created extra fields for the User account.
I have never had an issue with any of these fields showing up when constructing a View that aggregates based off of the User.
I just added a new Text field called "Job Title" to the User account.
I then created a basic view that aggregates based off of the User account.
The field "Job Title" shows up in the View for my logged in Administer account but NOT for an anonymous user or a user that is logged in but not an Administer and I can't figure out why.
Here is the "Job Title" field:

And the visibility on the field is set to "Public"

And here is my extremely simple view:

And here is the result of the view for my logged in Administrator user:

And here is the result of the view for an anonymous user (same as for logged in non admin):

Does anyone know what is wrong or where I should look to diagnose what is causing the field not not show up for the view? I have tried this with different views that aggregate on User and have had the same perplexing results.


texts: How to embed edit user profile page in a panel

texts:
I am trying to embed the edit user profile page (ie what appears at the url domain.com/user/27/edit) into a panel. I have searched high and low on how to do this but I can't find any info on it. Is it possible to do this? There reason why I am asking is that I want to clean up the user's profile page so that it looks more professional and is easier to use.

Can anyone point me in the right direction on how to accomplish this?

Thanks


texts: Problem with home page misaligned on website

texts:
The site in question is http://johannabolhoven.co.uk/.

As you can no doubt see, the home page seems to be misaligned from the other pages.
I've got the disable breadcrumbs module installed and I'm wondering if the problem is that the space is still being left for the disabled breadcrumbs, but it could also be something else.

I've tried (to the best of my ability) to disable the breadcrumb div in the template files, but that didn't seem to help either.


texts:
Actually we are using D7 mostly for books and book pages like manuals.

We would like to link files like PDF and Excel to a Drupal book page but we have no experience how to manage to open those files from drupal or view their content in drupal.

Therefore I would appreciate instructions for eventually necessary modules and settings.

We have a browser extension in chrome for PDF and see them directly in the browser , but from a Drupal page (localhost:8080/drupal/?q=it/node/398), the link to that PDF first gets me to another page (drupal/?q=media/1242`) and I have to click again on the PDF icon to open it in the browser. Thaty's somewhat annoying.
Can anyone please indicate a direct way for PDF and for Excel files? Is it necessary to fit the browser for Excel? if yes, how?


texts: How to redirect in WebformHandler after submitting Ajax form

texts:
I'm trying to redirect to a results page after a form that uses Ajax is submitted. The form is a semi long multi step form, so Ajax is enabled for the user experience.
I have created a new WebformHandler and I'm using the confirmForm() method, but I'm having difficulties to make the redirect work. The 'Confirmation' setting in my Webform is set to 'None'. I also don't see errors in the logs.
namespace Drupal\burnout_module\Plugin\WebformHandler;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\WebformSubmissionInterface;

/**
 * Send values to the matching API and get results back, redirects to results page
 *
 * @WebformHandler(
 *   id = "matching_api_handler",
 *   label = @Translation("Matching API"),
 *   category = @Translation("Webform Handler"),
 *   description = @Translation("Send values to the matching API and get results back, redirects to results page."),
 *   cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_UNLIMITED,
 *   results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 *   submission = \Drupal\webform\Plugin\WebformHandlerInterface::SUBMISSION_REQUIRED,
 * )
 */

class MatchingApiWebformHandler extends WebformHandlerBase {

  /**
   * {@inheritdoc}
   */

  public function confirmForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {

    // Get an array of the values from the submission.
    $values = $webform_submission->getData();

    // $result = ... code for calculating results with form values

    $url = \Drupal\Core\Url::fromRoute('burnout.match')->setRouteParameters(array('result' => json_encode($result)));
    $form_state->setRedirectUrl($url);

  }

}

I have also tried other possibilities:

Using a RedirectResponse which gave me a 'Headers already sent' error
AjaxResponse with a RedirectCommand, nothing happens, no errors

Hopefully someone can point me in the right direction.
Kind regards


texts: send variables other than $content and $subject to a custom block template

texts: I have a custom block defined with Drupal 7 hook_block's, and I need to send a custom variable to the block template that will be set on block_view function, is this possible?


texts: How do I migrate my site without doing a direct DB export and site upload?

texts:
I'm in an odd situation. When I try moving my site from my dev server to my production server the whole thing blows up. I think it is something in my database, it even happens if I export the DB with all but the core modules turned off.

So what then is the best way to export my site (nodes, users, views, panels, contexts et al) to the production server then?


texts:
How can I show help to a user one time only?

On my node form, I have some inline help under a few of the fields. I would either like the user to be able to close/hide the help or the help to be removed after a user has visited the page, so the user will not see the help again.

I have seen various modules for notification/messages which will only be displayed to an individual user once but this not suitable as I would like to have the help besides the field rather than the top of the page.

I have seen the qtip/tooltip modules also but as far as I'm aware these do not remember whether an individual user has closed the tip so next time the user visits the site the tips will be open again.

What would be the simplest way to display a tooltip/help message besides a field only once per each user. I know I can use php to check whether a user has seen the page or not, but unless I can some how use either the field help text or the tooltips with rules, I can only see this happening by writing a custom module. I was hoping that there was something which was similar to what I need already available though.


texts: How to change modified date in a node when users votes more than 5 times?

texts:
Mayday, mayday! :-) I have 2 views of nodes showing "published nodes" and "moderation nodes". I'm using vote_up_down in my nodes.

I want, when the users vote up a node more than 5 times, to modify the date of the node, and put it "now".

Can somebody tell me how I could do this?

Thanks.


texts:
It seems that, by default, Omega, and other themes do not render child links.

I have tried various modules (e.g. Superfish, and Megamenu), but they do not offer a structure that allows me to theme to the design I am after.

I found this page, but it does not seem to use theme_links().

Is there a simple way to enable all my menu links, and still be able to hook into it before they are rendered?


texts: How do I create a link that points users to the edit profile page?

texts:
I would like to create a link that leads each user to their edit profile page.

What should I use as URL? I get access denied on the paths I tried, including http://example.com/user/[uid]/edit.


texts: How to create multi select within select box in views expose filter in Drupal?

texts: I have created a view with exposed filter. It's working correct. But I need to use select box in exposed filter with multiselect.


texts: Apply view contextual filter only if user role is not administrator

texts:
I have a view that filter a list of taxonomies based on the taxonomies associated to the logged in user. This works fine.
Now, I need to create an exception only for users with role "administrator" that must see the complete list of taxonomies, without any filter applied.
I know how to check the logged user role in views, but I can't figure out how to avoid the contextual filter for the specific case.

IMPORTANT NOTE: sorry guys, I forgot to mention that the view will filter the taxonomies list in admin content-type form and not for the front-end pages.


texts: Get "File Upload Error" when I try to upload any images to Node

texts:
This was and is working fine in my local environment, but when its on the server (hosted by Justhostme) I get this error whenever I try to upload a new image to a node. I've seen advice that it could be my temp directory so I've changed this and set 777 permissions on it. I'm very stuck with this now. I'm not getting any more error message so nothing to hint at what else it could be.

heres hoping.

Edit. I've checked the logs, and these 3 messages appears when I try to upload.
The refered to folder has 777 access too.
Msg 1.

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access public://field/image/leaflet_front.jpg in file_save_upload() (line 1541 of /home/xxx/public_html/includes/file.inc).

msg2

Upload error. Could not move uploaded file leaflet_front.jpg to destination public://field/image/leaflet_front.jpg.

msg 3

The file upload failed. field_image_und_0


texts: How to embed a mp4 file in the body field?

texts:
Just that. I need to embed a mp4 file in the body field of a node. I'm pretty sure I can do this with the media, ckeditor and wysiwyg modules. But I just need to embed one video in the entire site, then enabling and doing all the setting just for one video seems a waste of time to me.

Is there any way to it in a simpler way?


texts: Creating a slideshow with images and text overlays

texts:
Does anyone know of a module or method to create a node where users can upload an image, add text on top of it through a WYSIWYG, then have the image combined with the text (merge the text and image into one jpg/png)?

We are trying to find a way for users in a school to add slides to our digital signage without using powerpoint, and I was wondering if there was a Drupal module that could do the job or help make it easier.


texts: How do I multisite with share user (and SSO), separate/dedicated users' role and content database on each site

texts:
I like to make Drupal 8 in CentOS 7 with Apache 2.4, mySQL and PHP 5.6 environment with requirements:

Multi-site within domain (site0.example.org, site1.example.org, etc.)
Shared local user account with SSO (userid, password, and all of user entities - name, email, address, phone, ...)
Different/dedicated content databases for each site
Different/dedicated users' role for each site

So, The user should be able to login in any sites and maintain the session across sites (SSO) but they may have different role, access and permission at different sites.

For example:

I'm login at site 1 (site1.example.org) and I have admin role in site so I can administer site 1.

But when I move to site 2 (site2.example.org) - I don't need to re-login again (SSO) but I may have a different role in site 2 (e.g authenticated user - view only).

What is the Best approach for this requirements?
Bakery? OpenLDAP? Saml? Or any other solutions?


texts: Where is the template for the promoted to front page items?

texts:
I want to add some elements and icons into the promoted items template but I can't find where this template is located.

For example, right now my page is rendering:

Sample

    //blah blah blah

    //blah blah blah

Instead, I would like to add things like:

Maybe some other stuff

Sample

    //blah blah blah

    //blah blah blah

Or anything else I want in the future.


texts: Create a subtype of Panel & style it with a template

texts:
So I'm trying to build a independent Landing Page for an event on our drupal 7 site. I would like to have the page contain a different main navigation menu then our site and also has the functionality of the content type "Panel".

I was Thinking to create a Content Type "Event" but how can I assign the Panel layout to it and how should I Assign that content type a specific menu?

The best solution would be to have a content type with the Fields:

Event Name
Panel Layout
Top Navigation Menu
...

after creating that content type I would create a theme template for that type. The template would modify the top and bottom of the page but the center should still be modified as the same as a traditional panel.

Atm I don't know how to accomplish that :(

Would love to hear some feedback guys!


texts: How can I add Support module's tickets to the homepage?

texts: I am trying out the Support module to create a client support ticketing system. Out of the box it seems to be configured so that I need to navigate to mysite.com/support to view the table of support tickets. How can I change this so that the support tickets appear on the homepage? Drupal version is 7.9


texts: Updated an empty field collection in Drupal7

texts:
New to Drupal and I'm assuming the answer is simple, I've looked through the test suites etc. and still missing the point it seems.

I have a node with a field collection (field_theatre_date_set) that will store a number of dates and times. I have loaded the node and the collection is there but it's empty.

I have used various forms of this and an obvious problem is that the $field_collection_item_value below array structure just isn't there.

Any further pointers greatly received.

$loop=0;
foreach($showing_array as $key=>$value){

 $date='xxxx';
 $time='xxxx';

 $field_collection_item_value = $node->field_theatre_date_set[LANGUAGE_NONE][0]['value'];
 $field_collection_item = entity_load('field_collection_item', array($field_collection_item_value)); // Load that field collection item

 $field_collection_item->field_theatre_date_set_date[$node->language][$loop]['value'] = $date;
 $field_collection_item->field_theatre_date_set_time[$node->language][$loop]['value'] = $time;
 $loop++
}
 $field_collection_item->save();

/**Update***/

Progress has been made. I still have an empty field_collection reference that needs to store a date and time.

I now understand that field collections store a value and a revision_id. I now need to work out how to store these revisions. I have the following code:

$field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_theatre_date_set'));

$field_collection_item->setHostEntity('node', $node);
$field_collection_item->date[LANGUAGE_NONE][]['date']   = $date;
$field_collection_item->field_description[LANGUAGE_NONE][]['time']   = $time;
$field_collection_item->save();

Now when I output the field_collection_item I see the following where I am expecting to see the the value and revision:

[field_theatre_date_set] => Array
            (
                [und] => Array
                    (
                        [0] => Array
                            (
                                [entity] => FieldCollectionItemEntity Object
 *RECURSION*
                            )

                    )

            )

And at the very bottom of the array I have the dates and times wallowing on their own:

[date] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [date] => 2014-03-13
                    )

            )

    )

[time] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [time] => 19:45:00
                    )

            )

    )

Any pointers on how to move them into my field_theatre_date_set if they aren't expecting date and time values?

Thanks all for looking!


texts: Views - Excluding a nid screws up "More" link

texts:
I have a view for my news overview in which I'd like to show 5 latest items. This works perfectly. Until I want to exclude the NID i'm on right now.

I exclude the NID by using the contextual filter and exclude the current Nid.

However; this screws up the More link attached to the view. It wants to go to the excluded NID now(Because of the contextual I think).

How do I get the More link to go to my news overview(As it is without the contextual filter) but still exclude the current NID?


texts:
I’m using feed module to import csv file. and the content type includes file field. I added the external file path in the csv file (file column). but It's not working.
Mapping includes:

Target:
Attachments: (field_file): File ID
Attachments: (field_file): Desciption

Feeds item: (feeds_item): item URL
Feeds item: (feeds_item): item GUID

Title(title)

csv:
ID
file
title

How I can deal with Attachments and Feeds item in source section. What I should put in the source section for Attachments and Feeds item.

Thanks in advance


texts:
In Drupal 8 routes like entity.node.webform.user.submissions (path such as /node/2/submissions), entity.node.webform_submission.canonical (path such as /node/2/submission/118) etc etc display entity view in the main content block. My question how would I append/pre-append/insert html elements (such as link tag,submit button, textfield etc etc) in the entity view.For example if the view shows a table listing submissions how to pre-append a link button at the top right corner of the table.
I have tried:

function my_module_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display){
    kint($build);
    kint($entity);
    }

In kint($build) and kint($entity) I can't see any part where to add HTML markup. How and where should I add it?


texts: Paths to images are messed up in Vagrant

texts:
All the paths linking to modules, javascript, css are correct when I move a site locally and run in a vagrant environment. Yet, the image paths stored in the site come out wrong, so they are all borked.

The console in Chrome shows the paths to the images as skipping a folder. This is how the path looks: localhost/sites/default/files/img.jpg

This is how the path should look: localhost/sitename/sites/default/files/img.jpg

For some reason, Drupal in Vagrant looks for the sites folder in the localhost folder. I feel like something is wrong with the way apache is set up on my Vagrant installation. But I suppose it could be a number of things. Does anyone know?


texts: Suggest a page template for a specific view

texts: I have a view news how do you a suggest a particular theme file for it? For example page--news.tpl.php?


texts: Missing video formatter for embedding media into ckeditor

texts:
I installed the media entity module, the video embed field module and also the entity embed module.

Then I created a media bundle for videos. Created a embed entity button for media and added it to CKEditor

I created a new video bundle entity with a link to a youtube video. When I visit the entity I see the embedded YouTube player and I can play the video.

So far so good. Now I like to embed this media entity into another entity (Content type "Article"). I can do this over the CKEditor button created before and I can also select the video media entity.

What's not possible is to render the entity as an actual video. The only options are Label, Entity ID and Thumbnail. But a Video formatter is missing.

Probably I miss something? A well hidden option to (un)check or even a module to achieve this?


texts: Running a site from a sub-directory of the web root

texts:
I have a shared hosting account that I would like to set up a Drupal 8 website on. However, been the primary domain for the hosting account, I cannot change the hosting directory where CPanel serves-up the web content. I can install Drupal 8 in a sub-directory off the web-root, however, I would prefer the sub-directory portion not be shown in the URL (i.e. http://domain.com instead of http://domain.com/subdir). I have incorporated drupal-composer/drupal-project into my project.

Does anyone have a working .htaccess file that resolves this scenario?


texts:
I have a panel page that includes several views. I want to use the title field of one of the views as the page title. So far, I have not been able to figure out how to do this.

I have installed Panel Variant Page Title module. However, I don't seem to have access to the field I want to use. The closes substitution available is %arg:title.

If I use this substitution, the page title is set to the whole URL.

Any ideas about how to accomplish this?


texts: Validate new user email name matching a pattern on registration

texts: Upon new user registration, how could I validate that the email address has a ".edu" extension? Basically, I need to ensure that users are using only their ".edu" email addresses to register for accounts.


texts:
I am working on creating a view based on nid in Drupal 8.  I cannot find node id or nid listed - I see Entity id. I am trying to set up a contextual filter so only certain node fields (node type B) will show up when node type B's relationship field matches the node alias of node type A.
(I am looking at https://www.drupal.org/node/1841004, but the terminology is different for Drupal 8.)


texts:
How  to display dynamic allowed values list in drupal 8?

In drupal 6 while creating cck select list, I written php code instead of entering allowed values. The sample code of drupal 6 is as follows :

$query = db_query("SELECT distinct field_x_value as x FROM {node} n, {content_type_y} ctdr , {content_field_x} cfer WHERE n.nid = ctdr.nid and cfer.nid = ctdr.nid and field_x_value is not null and field_user_state_value = %d and n.status = %d and field_environment_value = %d", $user->user_state, 1, $environment);

How to do the same functionality in drupal 8?


texts: How do I embed a node information/content into another node?

texts:
I have two content types. One is author (fields are author name, designation, bio, image etc) and another one is article. In article content type, I have created an entity reference field "Author Info" where target bundle is author. While I am creating article, I get author list in Author Info field and I can select an author from the list.

When visiting the article page I only see the Author name/title under Author Info field. But I want to display there all author fields information.

I did some search to find out a way but no luck so far.

How I can do that?

Do you have any hint about that or what to search for?


texts: How to access data from a page on a form hook?

texts:
I have a page that has a $_GET and I would like to use that value on the form that is used on that page, but I do not know how to pass a variable to that form for use. usually I can just get the data from elsewhere, but the $_GET is NULL when I run it in the form itself.

function mymodule_menu() {

   $items = array();

   $items['sample'] = array(
    'title' => 'Title',
    'description' => '',
    'page callback' => 'mymodule_page',
    'access arguments' => array('access content')
  );
}

function mymodule_page() {
    $variable = $_GET['variable'];
    return theme('mymodule_page', array(
       'form' => drupal_get_form('mymodule_page_form'),
       'variable' => $variable
    ));
}
function mymodule_page_form(){
    var_dump($variable); <-- not defined.
}

I tried variable_get and variable_set, but it's not reliable because it seems to hold values for a while.


texts: Entity Form to insert data into Custom Entities

texts:
I am finally getting to Entity Construction Kit. I have built out my entity with fields, I have also set up a feed to import data into the entity.

However, I also need to build a form that will push data into the entity fields in the database. I need to know how to do this. I have search and have yet to find anything that explains or shares knowledge on how to handle this.

Has any built a form that will insert data into the database without a custom coded module?

I do not want to add data from the 'entity list' tab. I actually have a use case where I need to insert several rows of the same thing. So, for instance when doctors show up at an event yet they don't give us there information I still need to insert 5 MD's showed up for the event.

Hopefully this makes sense. Any help is greatly appreciated!!!


texts: how to show the same slideshow view on different sites but with different images - I have multiple sites which needs to show the same slideshow with different images. Can anyone explain how to go about this. I am relatively new to drupal and I have already setup the slidehow view / cycle module and created slideshow view and slideshow content type for one of the site and its working al good. Now I want to replicate the same on the other site (all the themes and the templates and css are the same its basically white labelling) but just use different images.


texts: In a manually created menu, when a taxonomy term is a parent with children, the children never display. Bug?

texts:
I manually created a menu where each parent term is a taxonomy. so:

Menu name:cars

Path: cars

Note that 'cars' is a path auto generated url for taxonomy/term/3.  I thought you could only put nodes here, but this saves instead of giving the usual error when the path is not available.

Each one of these parent items has 1 level of children. Or, should at least.

In the Structure > Menu view, you can easily see the menu structure with parent and children.

however, when this is rendered as a menu block, only the parents are displayed. Is this because the Parent is a taxonomy term and not a node?

One of the reasons I think it may be a bug is that if you look at the source code the html shows 'collapsed' as an li class, indicating that it knows it needs to have children here. The second reason I think this is a bug is that if I change this to node/(number) then everything works fine.
Anyone know a solution to get this working?


texts:
I am currently working with Permission by Term to set simple access control on two node types with terms.

As noted here, I believe I found a bug where the access record isn't written the first time the node is saved. That modules internal queries don't return any term ids for this new node, because the data doesn't appear to be committed to the database yet.

This causes a new node to:

Show up in a View for a user who does not have access
Show up in a Menu for a user who does not have access (menu link)
Show up in a search, I assume (I don't have any search of these node types though, so)

You couldn't access the node itself (node/{id}) as a role without access, but the logic that checks that is different...

The second save (and any after) seem to create the right access record in the database. I see it flip from "all" to "permissions_by_term".

So, I resorted to patching in my own functionality to fix what isn't working for me:

declare(strict_types = 1);

use Drupal\node\NodeInterface;

/**
 * Implements hook_node_access_records_alter().
 *
 * @see https://www.drupal.org/project/permissions_by_term/issues/3017347
 */
function mymodule_node_access_records_alter(&$grants, NodeInterface $node) {
  $grant_to = ['protected_file', 'protected_page'];

  /**
   * @var \Drupal\permissions_by_term\Service\NodeAccess $nodeAccess
   */
  $nodeAccess = \Drupal::service('permissions_by_term.node_access');

  if (
    in_array($node->getType(), $grant_to) &&
    !$nodeAccess->isAccessRecordExisting($node->id()) &&
    !_mymodule_grant_exists($grants, $node)
  ) {
    $grantObject = $nodeAccess->createGrant($node->id(), $node->id());

    $grants[] = [
      'realm'        => $grantObject->realm,
      'gid'          => $grantObject->gid,
      'grant_view'   => $grantObject->grant_view,
      'grant_update' => $grantObject->grant_update,
      'grant_delete' => $grantObject->grant_delete,
      'nid'          => $node->id(),
    ];
  }
}

/**
 * Check the grant array for any duplicate.
 * A duplicate may occur when permissions are rebuilt.
 *
 * @param array $grants
 * @param \Drupal\node\NodeInterface $node
 * @return bool
 */
function _mymodule_grant_exists(array $grants, NodeInterface $node) : bool {
  foreach ($grants as $grant) {
    if ($grant['realm'] === 'permissions_by_term' && $grant['gid'] === $node->id()) {
      return TRUE;
    }
  }

  return FALSE;
}

I ran into a duplicate key error when rebuilding permissions, which is what the second function is for. The isAccessRecordExisting method checks the database, and when they're rebuilt the record won't exist.

Admittedly, despite all the time in Drupal, I don't know a whole lot about the access and grant system. The entity type containing a term reference field flagged with Permissions by Term options should get a record inserted with it under its control, but thats not what I am seeing happen.

After I added the code above, all the problems seemed to vanish. Links didn't appear in menus for certain roles, or in Views, saving nodes updated View displays and access appropriately. I could not get it to show me something I should not see.

Is this an adequate fix for what I perceive to be not working, or at least, not working for me? Is there a better way to set a record when the node is created?


texts: Site with Themekey has CSS cross-contamination

texts:
I'm using Themekey with Context to enable one of three different themes on a site, depending on a themekey field. The homepage is set to use my main theme, called 'sitetheme'. Sitetheme is set as default, but many themes are enabled.

All the pages that I've tested look good, including the homepage. There's just one exception. My main menu, a horizontal header region menu block that uses Nice Menus to create dropdowns, has weird styling on it. When I inspect the element, I see that it has styling applied from a CSS file that lives in a different theme than the one that is enabled on the front page.

The front page is also of a nodetype that doesn't have the themekey field that some of the nodetypes have, that can be used to override the theme.

Why is my foo theme's CSS for Nice Menus getting applied on pages that use Sitetheme?


texts:
I want to remove the core search index. In Drupal 7 I achieved this by adding the following line to the settings.php file.

$conf['search_cron_limit'] = '0';

What is the equivalent for Drupal 8?


texts: Take messages generated by module and print them inside the node teaser?

texts:
I have a Pay2Publish module, which gets no support these days, so I have to turn to the community for the help.  I guess this is a simple PHP question:

I want to take the messages generated by Pay2Publish module and display them bellow each node teaser.

Here's the code from the module:

/**
 * Implements hook_node_view()
 *
 * Displays the Message for the author of a node
 */
function ms_paypublish_node_view($node, $view_mode, $langcode) {
  $plans = variable_get('ms_paypublish_plan_' . $node->type, array());
  $pp_node = ms_paypublish_load_node_nid($node->nid);

  if ($pp_node AND !empty($plans)) {
    if ($view_mode == 'full' AND user_access('renew own pay to publish nodes')) {
      global $user;
      if ($node->uid == $user->uid) {
        switch ($pp_node->status) {
          case 0: // Not Published
            drupal_set_message(
              str_replace(
                '!link',
                l(t('Publish'), 'ms_paypublish/publish/' . $node->nid),
                variable_get('ms_paypublish_not_published_text', 'This content is not published. To publish, please click here: !link')
              )
            );
            break;

          case 1: // Published
            if ($pp_node->expiration_date) {
              drupal_set_message(
                str_replace(
                  array('!days','!link'),
                  array(
                    ms_paypublish_get_expiration_string(ms_paypublish_get_expiration($node->nid)),
                    l(t('Promote / Extend'), 'ms_paypublish/publish/' . $node->nid)
                  ),
                  variable_get('ms_paypublish_published_text', 'This content will expire in !days days. To Promote / Extend, please click here: !link')
                )
              );
            }
            break;

          case 2: // Awaiting Admin Approval
          case 5:
            drupal_set_message(variable_get('ms_paypublish_approval_text', 'This content is Awaiting Admin Approval. It will be published shortly.'));
            break;

          case 3: // Not yet published
            drupal_set_message(str_replace('!link', l(t('Publish'), 'ms_paypublish/publish/' . $node->nid), variable_get('ms_paypublish_publish_text', 'This content has not been published yet. To publish, please click here: !link')));
            break;
        }
      }
    }
  }
}

What do I need to put inside my custom node--content-type.tpl.php so that these messages are displayed below each teaser?


texts: Contextual filter only working on one URL

texts:
I've been going through posts such as View block not accepting contextual filter argument, Contextual filter on Views Block file not found, How do I get a block to use a URL to configure a contextual filter?, Contextual filters help, Contextual filter with a block view and more to find the solution or my issue with no luck.

In short my contextual filter only works on 1 of 5 pages I want it to work on (they other 4 pages doesn't return any results). The working page is label/artists

I've got a taxonomy vocabulary called site_sections and an artist content-type. I've got a View Block of artist teasers, that I want to filter contextually by a part of the url alias.

I've got a term reference on each artist node to the site_section terms which are

label
publicity
shop
management
wholesale

My view is a block showing artist teasers. The block is displayed on these URL aliases:

label/artists
publicity/artists
shop/artists
management/artists
wholesale/artists

My contextual filter:

Content: Site section (field_site_section)

WHEN THE FILTER VALUE IS NOT AVAILABLE

Provide default value: Raw value from URL
Path component: 1
Use path alias: Y

WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED

Specify validation criteria: Taxonomy term (site section)
Filter value type: Term name converted to term ID
Transform dashes in URL to spaces in term name filter values: Y


texts: View filter on date "Less than or equal" AND NULL(empty)

texts:
I just made a view with some filters (date), I wonder how can I choose the operator to mix the options "Less than or equal" and NULL, in just one request? I can't do that with "Grouped filters", Should I hook the code? If that's so, where?

Thanks so much


texts: How to not display the password match message on page load?

texts:
In Drupal 8, by default, the Passwords match: message is visible on page load, then hidden after entering a first password and finally visible after entering the password again.

I would like to override this so that style="display:none;" or a specific class will be added to the "Passwords match:" div if no value has been entered in the "Confirm password" field.

Of course, it would be great if the "style="visibility:hidden"" and "style="visibility:visible;" could be removed as well.

How can I achieve this?


texts:
I need to debug an issue and don't know how to start.

If I'm logged in the cart works just fine but, if I log out and put something in my cart I see the object in the cart widget but not my cart page.

And this is the markup in the page.

I need a hint to understand where to start searching the issue because the cart page permission and the view permission I think are fine because I see them, but the content is wrong..

If I go in admin/structure/views/view/commerce_cart_form/edit page and I insert the order ID, I can see the right cart displayed in the right way..

Where can I start to debug this?
Do you have a clue to where can the bug be?

I tried to put a couple of prints in the view header and the cart page remains blank. But why is the empty cart sentence not displayed if the order_id is empty?
And why 2 different carts views in the same page act so differently?


texts: Create taxonomy 'add terms' form into block

texts:
I have two vocabularies named 'vocab_one' and 'vocab_two'. I create custom multiple blocks module named 'add library', in order to display the taxonomy 'add terms' form to each blocks.

Each block displayed on the same node in the content area. The position of 'Vocab Two Block' are above 'Vocab One Block'.

When I add new term on 'Vocab One Block', the new term is always stored in the 'vocab_two'. Then I switch position of the block. This time, the new term is always stored in the 'vocab_one'.

How to store a new term within selected vocabulary, without worrying about the block position?

here is my add_library.module:

function add_library_block_info() {
  $blocks['Vocab Two Block'] = array(
    'info' => t('Vocab Two'),
  );

  $blocks['Vocab Two Block'] = array(
    'info' => t('Vocab One'),
  );

  return $blocks;
}

function add_library_block_view($delta='') {
  $block = array();
  switch ($delta) {
    case 'Vocab Two Block':
      $block['subject'] = t('Add Vocab Two');
      $block['content'] = add_vocab_two();
      break;
    case 'Vocab Two Block':
      $block['subject'] = t('Add Vocab One');
      $block['content'] = add_vocab_one();
      break;
  }
  return $block;
}

function add_vocab_two() {
    module_load_include('inc', 'taxonomy', 'taxonomy.admin');
    $vocabulary = taxonomy_vocabulary_load(2);
    return drupal_get_form('taxonomy_form_term', $vocabulary);
}

function add_vocab_one() {
    module_load_include('inc', 'taxonomy', 'taxonomy.admin');
    $vocabulary = taxonomy_vocabulary_load(4);
    return drupal_get_form('taxonomy_form_term', $vocabulary);
}


texts: Apply percentage coupon to entire order (Commerce)

texts:
I am using Drupal Commerce and Commerce Coupon Percentage. It works great for most products. However, I have a product priced at $0 and the price is then altered through rules which changes the line item total for that order.

Because the product is priced at $0, the percentage does not apply. Therefore, I am wondering if there is a way to apply the percentage coupon to the entire order rather than the product price. Any thoughts on how to approach this?


texts: Do I need to build out CCK fields before migrate_d2d_ui?

texts:
Using the migrate_d2d_ui module to migrate Drupal 6 cck content to Drupal 7, I previously asked "Do I need to create CCK content types before migrate_d2d_ui?" and presume the answer is "Yes" based on my personal experience.

This follow-up question is whether it is necessary to also build out all the cck fields for content types containing cck fields.  I am hoping the answer is "No" as this would imply a lot of work.

It would seem that migrate_d2d_ should be smart enough to recognize the D6 cck fields and create the corresponding D7 fields.

Thanks


texts: Print taxonomy term description onto product page

texts:
I am currently running Drupal Commerce 7.

The products listed are all referenced to different designers through a "Designer" Taxonomy.
Within the Taxonomy, the individual terms, i.e. the different designers have an added description. I would like to know if there is any way to print on the product page the description for the particular designer referenced by the page.

For instance I have a shoe. I have it designed by Mary under "Designer". I have also attached an example description for Mary: "Mary is a great designer". I would like to print this somehow onto the product page.


texts: How to override links in each Views feeds?

texts:
I would like to override all links in all views feeds through a hook (potentially) - for example adding an extra query param to each item links.
I need a general function. When defining a new feed, the field name is unknown, so I can't rely on the exact name -> cannot use a specific preprocess hook.
I checked all Views hooks here: http://drupalcontrib.org/api/drupal/contributions%21views%21docs%21docs.php/6 but couldn't find a right one. I was playing a lot with different preprocess functions, no luck.
One idea is to override a field handler, but I'm not sure how to execute that.

What would you suggest?

Thank you!


texts: Feed Import is successful and shows number of nodes imported but nodes not listed under content

texts:
I am using the Feeds module to import content from a different Drupal site as xml.

The problem is that the feed import is successful, and a message says how many nodes of the new content type it has created. But when I go to content or to the database the content imported is nowhere to be seen.

What is the workaround for this issue? Is it a bug in the module?


texts:
How can I display the title in URLs instead of the taxonomy ID?

www.abc.com/search-page?tid=01 should be www.abc.com/search-page?title=this-is-the-first-post.

I am using Taxonomy Terms as Search in Views (Configure filter criterion: Content: Has taxonomy term). When I click on taxonomy, I will find more button; when I click i will find "Filter identifier" by default "tid" is present.

When i tried to change that to title, it displayed Page not found.

On Views >> Advanced >> Contextual Filters, I added the field for the title, but even this is not working.

Thanks


texts:
What if I just want to trigger the first colorbox on a view page? maybe with js injector module.

  Drupal.behaviors.commerce_kickstart_theme_custom_mytest = {
    attach: function(context, settings) {
        $(document).ready(function() {
            $('.view-promoted-to-front-2 .views-row-1 > .views-field-rendered-entity .node-product-display .field-group-colorbox-trigger').trigger('click');
         });
    }
  }


texts: How to filter and retrieve multiple entities at the same time?

texts:
I am using Drupal 8 country module and have over 100 countries. I've enabled all related modules for Drupal 8 web services to operate.
My task is that I need to retrieve say 30 specific countries filtered by say status = true. All the examples I see point to GET retrieving a single item, for example the url below works... (http://localhost/truemandate/entity/country/NG?_format=json). But how do I retreive multiple items at same time using REST? I know JSON-API does this easily using filters - but the output of JSON-API seems too verbose for my requirements.
I've also heard you must create a view before REST can return multiple entities. Not sure the impact of this on performance. I also have about 20 other custom entities which I need to be able to retrieve multiple items from all at once(using my mobile app).
Should I use REST or JSON-API for this? Please I'm open to suggestions on best way to expose a fast, well-built country list web service


texts: discount coupon has applied on complete order not specific product in the order

texts:
commence ( commence discount ).coupon code is applicable  only one product.  but As per attached image coupon has redeemed price on  all product in the cart.i am explaining in details here.There are two product with name
1.Preventing Sexual Harassment at the Workplace - Certificate Programme with original price ₹3,596.00
2.Intellectual Property: Law and Management - Certificate Programme with original price ₹3,596.00

i have applied 20 % coupon only first product it should be redeemed -₹899.00 but it has redeemed -₹1,798.00 rather than ₹899.00 it means it is redeeming same amount on another product also however i have not applied coupon on 2nd product.

HELP WOULD BE GREAT APPRICATED


texts:
Ok, I am struggling with this one a bit so I am going to describe this in the most simplest of forms.

I run a Drupal 7 website that is a holiday resort guide for Magaluf. The site lists in detail all things relating to the resort; ie. Hotels, Bars, Restaurants, Event Tickets etc.

I am now expanding into other resorts. I am playing around in the correct way to go.

So, I have a node type - Restaurant. When I create a new node - restaurant I have many fields. 2 of these fields are taxonomy terms to tag the restaurant in the right way. They are:

[taxonomy-term:resort] & [taxonomy-term:cuisine]

Say I create a new restaurant, for example 'Joes Fish and Chips' that is based in the resort 'Magaluf'. When creating the node, I will tag this restaurant by 1st selecting the term [Magaluf] in the [field_resort], as well as selecting multiple [taxonomy-term:cuisine] term's for the field_cuisine.

So now, I have my restaurant.

I have set up a url path for all restaurant nodes as follows

resort/[field_resort]/restaurant-guide/[node-title]

I have just started to play around with panels. I have created a panel page where it displays a list of all the restaurants in teaser display based on contextual filters from 2 arguments.

The contextual filter arguement: resort/%1/restaurant-guide/%2

%1 = [taxonomy-term:resort]
%2 = [taxonomy-term:cuisine]

So, if you type in the url www.domain.co.uk/resorts/magaluf/restaurant-guide/fish you will get a list of all the restaurants in 'Magaluf' that have been tagged with 'Fish'

WHAT I AM TRYING TO DO.

I would like a way to display all the [taxonomy-term:cuisine] in a pane on another panel page which is;

www.domain.co.uk/resorts/magaluf/restaurant-guide

The taxonomy terms will be listed and the url's for each term should have the arguments of the panel page .Once you click on one of those terms, this then takes you to the panel page argument for that specific resort; ie;

clicking on FISH on the domain www.domain.co.uk/resorts/ZANTE/restaurant-guide will now take you to www.domain.co.uk/resorts/ZANTE/restaurant-guide/FISH

clicking on MEAT on the domain www.domain.co.uk/resorts/IBIZA/restaurant-guide will now take you to www.domain.co.uk/resorts/IBIZA/restaurant-guide/IBIZA

Hope you understand.


texts: Best practices when choosing a method of displaying content?

texts:
This is a little broad, but I have a specific example. I'm new to Drupal, with a WordPress background. I'm getting some of the core Drupal concepts down, but I'm left with some questions.

How do I know what method of displaying content is best for a situation? For example, I'm running Ubercart. I would like to display a single featured product on the home page. As far as I'm aware, I can't use a block because I'm not sure if I can pull node data into that. I could hard code it in the template file, maybe? Can I use a view?

Is there somewhere in the documentation where this concept is spelled out?

Thank you for the help.


texts: create a downloadable file after submit webform

texts:
Hello Im not sure if this can be done, but Im trying to make a simple app where you create your own lexical analyzer.

So in the webform I ask the necessary information, then I need the following:

After send the webform generate a script file (from a template I already have done)
I need a way to replace some tokens in the script file with data from the submitted webform
Let the user download the generated script file

Any idea how to achieve this? maybe it is not that complex...

Thank you very much


texts: Is it safe to call field_view_field() for a field that isn't attached to the given node?

texts:
My page.tpl.php includes:

if ($node) {
    // field_suburb is a "text" field that doesn't exist on this node type
    $f = field_view_field('node', $node, 'field_suburb');
    print render($f);
}

This triggers:

  PHP Fatal error: Cannot access empty property in field/field.attach.inc

I added the following debug code in field.attach.inc ("if field name is null" block):

foreach ($languages as $langcode) {
    if ($field_name === null) {
        print $field_name === null ? "FIELD NAME IS NULL\n" : '';
        print $instance == null ? "INSTANCE IS NULL\n" : '';
        print "$entity_type $bundle\n";
        print_r($instances);
        print_r($options);
    }
    $grouped_items[$field_id][$langcode][$id] = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array();
    // Group the instances and entities corresponding to the current field
    $grouped_instances[$field_id][$langcode][$id] = $instance;
    $grouped_entities[$field_id][$langcode][$id] = $entities[$id];
}

That code prints:

FIELD NAME IS NULL
INSTANCE IS NULL
ENTITY TYPE: node BUNDLE: news
Array
(
    [0] =>
)
Array
(
    [field_name] => field_suburb
    [language] =>
    [default] => 1
    [deleted] =>
)

This is easy enough to protect against - I can just check my node type before accessing the field - but surely field_view_field should just return null for a field that doesn't exist instead of having the entire site die?!?

Should it be safe to call field_view_field() - i.e. is this a bug? If it's not a bug, then what's the easiest way to check to see if my given node content type actually has the field I'm rendering? Checking the type against a list of known safe types isn't very flexible, and calling field_get_items() followed by field_view_value() seems redundant when field_view_field() is available.

Drupal version is 7.22.


texts:
I am new to Drupal. Learning Drupal 8. I am little aware of "hooks", but I am little confused.

For example, I have installed Rate module.

Now, I am trying to do more things based on user's action on RATE, whether vote up/down?

On each vote up/down, add some more details on Node and reward/penalise the node author.

I have tried doing: in my my_module.module file

function my_module_vote_rate_vote_alter($vote, $context) {
    drupal_set_message(t('called '), 'error');
}

But this does not display message.

I know this is third party extension.

But I am more interested in how to know, which alter/hook method I can use within the module/drupal.


texts:
i'm using Drupal 7.15 and latest Privatemsg. I set up access and sucessfully sent a message to a user. As user, i see notification "Messages (1 new)", but when i'm clicking on it, i got an error.

  PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "user_3" LINE 4: WHERE (base.uid IN ('user_3')) ^: SELECT base.uid AS uid, base.name AS name, base.pass AS pass, base.mail AS mail, base.theme AS theme, base.signature AS signature, base.signature_format AS signature_format, base.created AS created, base.access AS access, base.login AS login, base.status AS status, base.timezone AS timezone, base.language AS language, base.picture AS picture, base.init AS init, base.data AS data FROM {users} base WHERE (base.uid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => user_3 ) in DrupalDefaultEntityController->load() (line 196 of /home/www/www.devbros.net/htdocs/includes/entity.inc).


texts: How do I use a custom Field Formatter to display multiple rows in views for multivalued field?

texts:
On my Drupal 8 site I'm trying to create a view of a custom entity that contains a custom field type which is multivalued in the entity. It works fine when I try to display the multiple values on the same row, but when I uncheck the checkbox in views to move them to separate rows, I do end up with multiple rows but it still displays both values on the same row, just in multiple instances. Worse, it just shoves them together without any sort of separation. For instance:

Row 1: Item1Item2

Row 2: Item1Item2

When it should be:

Row 1: Item 1

Row 2: Item 2

Again, it works fine if I want them in the same row, using Views multivalued format, so I'm guessing the problem lies somewhere in my custom FieldFormatter. For the sake of testing I'm just displaying the deltas for each item, which come out as 01 on the rows that have multiple values and 0 on the rows that only have one value.

Here's my viewElements method in the field formatter:

public function viewElements(FieldItemListInterface $items, $langcode) {

  $elements = [];

  foreach ($items as $delta => $item) {

    $elements[$delta] = [
      '#markup' => $delta ,
    ];
  }

  return $elements;
}

This type of thing seems to work for the core field formatters that I looked at, but is obviously not working here. Does anybody see anything odd or missing from this?


texts: Commerce 2 Add to cart with quantity field and Product Picture

texts:
I have added an image field in product variation type. Add few products to my store. Now when I am going to product detail page to add the product in cart it just shows the add to cart button without any quantity field. Also not showing Image of the product.

I tried to change the formatter to Rendered Entity, but it then only showing the picture  and price but not the add to cart button. Rendered Entity was using default view mode. So I created additional view mode through manage display of product variation type but that also didn't provide any option to show the add to cart button.

What I want is to display the product variation picture + Price + SKU + Add to Cart button with quantity field.

Please guide me how to achieve this.


texts: Parse feed items into nodes, but also get full html from link by scraping the site

texts:
I am using feeds to create nodes from an rss feed. I also use feeds imagegrabber to grab the image from the webpage.
But I can't seem to follow the links to each item and scrape it.

The feeds usually only show the teaser text, but I want to scrape the page with the full text and save it.

Can anyone explain to me how this is done?

Here is an example feed:  http://feeds.washingtonpost.com/rss/homepage


texts: How to create a raw link in view(with contexual filter) custom text

texts:
I am creating a block in view.
I have a content type with a field(plain text).
I am passing contexual filter "content id" from url.

I am giving value in the fields as "www.facebook.com/SomePage"
Now i want that to be created as link text from custom text in views.

In custom text i am providing

    Click Here

Now when i click here it is redirecting me to "[sitename]/node/www.facebook.com/SomePage"

I want to open like www.facebook.com/SomePage.

How to do.
Any suggestion?


texts: Insert videos from media module into Ckeditor

texts:
I've been working the media module and inserting images with the ckeditor media widget and It's been great.

I've also used some embbed media plugins to add vimeo and youtube media elements wonderfully.

But when I try to insert some of this media into the ckeditor it only inserts the rendered image form this media instead of the widget i get when I render the media in a node.

I need to know if I have to configure the file-types/ output in the media module or config anything in the ckeditor.

Thanks


texts: How to show the author of Blocked users's Content as anonymous in Drupal 7?

texts:
I have a Content type Board. All authenticated users can add boards. when i displaying the Board's Nodes i am also showing the author name. All going good.
But when a user delete his account i set his status as blocked.
If a user has been blocked then i want to show Anonymous author on board's node created by that blocked user.
I searched here and there but could not find solution. Any Help please
Thanks in Advance.


texts: Show total count of items on page created by views

texts:
What is it right way to show total count on views?

I found this print count($view->results);


texts:
I have created a site consisting of image galleries, gallery consists of image and a description for it. I want that the user should be able to select multiple image contents as checkbox so that he can add them to cart. After selecting the images I want to compare the details of the selected images.
How can I achieve this?


texts: How to clone a node without translations

texts:
I have a site with multiple language. Assume I have a node (nid = 1) with origin languages is en and translate to es. And I clone this node with code:

$node = Node::load(1);
$nodeDuplicate = $node->createDuplicate();
$nodeDuplicate->save();

And I have a new node (nid = 2), and the new node have two content translate en, es same the node id 1.

But I don't want clone all content translate. I only want to clone one language es or en. So how can do that?


texts: How do I implement cookieless subdomain?

texts:
Cookieless subdomains are considered beneficial for a number of purposes:

They save some network overhead [1], and
they are required for certain types of caching [7] (e.g. reverse proxy like Varnish).

The most straight-forward way to implement is to create a sub domain of the main domain (A or CNAME host record in DNS), then set up a virtual host on the webserver and lastly configure a CDN with shared sub domains. [2] suggests to configure the cookieless Vhosts in Apache like this:

<VirtualHost *:8081>
  ServerName cdn.example.com
  <Directory /var/www/example >
    RequestHeader unset Cookie
    Header unset Set-Cookie
    […]
  </Directory>
</VirtualHost>

In Drupal, a CDN with shared sub domains can be implemented with the 'CDN' module and a CDN mapping like suggested in [3]:

http://css.example.com|.css
http://js.example.com|.js
http://img.example.com|.jpg .jpeg .gif .png .ico

At this point, CSS, JS, and images are delivered through the respective subdomains; however, according to firebug, these objects still have cookies attached to them, so Varnish can't cache them efficiently (or not at all).

These are some sample cookies I'm getting attached to an image that is delivered through the CDN sub domain img.example.com:

__utma=192369400.1671803289.1403302173.1403302173.1403302173.1;
__utmz=192369400.1403302173.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
__utmv=192369400.|1=User%20roles=anonymous%20user=1;
__utma=164879789.945246956.1281184906.1403129675.1405102008.2582;
__utmc=164879789; __utmz=164879789.1396142298.2568.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
__utmv=164879789.authenticated%20user%2CSysop|1=User%20roles=anonymous%20user=1

All these cookies are set from/belong to the main domain www.example.com; I don't know what application/module sets the other cookies, but those including an Drupal user role are clearly set by Drupal. How do I get rid of them on images and what am I doing wrong here?

Some of the other cookies are probably set by the 'Google Analytics' module which are "usually set on a domain-wide basis to cover all subdomains" [6]. However, this module allows to configure ./admin/settings/googleanalytics, if GA is supposed to track one domain, or multiple sub domains (of course I chose "single domain").

Is an additional functionality required to allow Drupal (in my case Pressflow) to actually allow cookieless subdomains? For example, there is an 'Cookieless Subdomain' module at drupal.org [4] (undocumented; dev release; very few users). Do I need this, or is there another way outside of Drupal, e.g. in the Apache or Varnish configuration ([5] suggests that "varnish really isn't made to do redirects")?

[1] developer.yahoo.com/performance/rules.html#cookie_free
[2] webmasters.stackexchange.com/questions/1772/how-do-i-set-up-a-cookie-less-domain
[3] www.drupal.org/project/parallel
[4] www.drupal.org/project/cookieless_subdomain
[5] serverfault.com/questions/275728/varnish-serving-static-files-from-subdomains-for-better-page-load-speed
[6] serverdown.ttwait.com/que/275728
[7] www.ravelrumba.com/blog/static-cookieless-domain/ (Wordpress)


texts: Disable autocomplete entity reference field

texts:
In my page content type, I've created an entity reference field that references another page content. When entering data into the entity reference field, it does a search of all the content on the site and returns a list of it. I want to be able to just enter in the node ID, instead of making it search for it.

Currently, you cannot just put in the node ID, as it will throw an error about content not existing.

Is there a way to just input just the node ID? Is there a special format?


texts: Getting error on installing bootstrap subtheme?

texts:
Why i am getting this error "Unable to install bootstrap_subtheme, THEMENAME.settings has unmet dependencies". ?

Also my themename.theme file showing error on renaming "The item could not be renamed." for removing this error i created a clone blank file with name bootstrap_subtheme.theme and copy content of original themename.theme file ,paste it into the bootstrap_subtheme.theme file and finally deleted the original themename.theme file.

Still i am getting the following error Unable to install bootstrap_subtheme, THEMENAME.settings has unmet dependencies.


texts: Creating a new Workbench view showing recently updated content and its state

texts:
This is a simplified example to show my problem.

I've added a handful of Workbench moderation states (and plenty of transitions) into my workflow system.

I need to create a new table view to display content with the following columns:

Title
Revision review date
Moderation state

(I want to either add an external filter on the moderation state, or separate the states out into multiple displays).

This is what I've done:

Created a new view of Content revisions
Added a Workbench Moderation: State field using the relationship to the Content revision
Added sort criteria of Content revision updated date descending to show most recently updated nodes
Removed the 'Published' filter - as the content under review might not be published yet.

However, what I see is repeated content. After adding a filter 'current moderation' I know that to reduce the duplicates, it would be necessary to add a filter 'Workbench Moderation: Current (Yes)'. However, after adding this filter, the list doesn't show the current moderation state. Is this a bug?


texts: Can't submit entityform after ajax callback on select element

texts:
I followed the advice from this link and migrated the code populating my ajax into buildForm(), and all is well. Select list is populated by ajax and elements are preserved even after form submit. Problem is that I get the following error when I try to submit the form -
The value you selected is not a valid choice

I've tried adding the popular '#validated'=TRUE option to my ajax select, but this causes 2 things to happen

My ajax callback only successfully replaces the content of the
select once, subsequent calls have no effect whatsoever, the old
content of the select remains
I get a really bad error when I try to
submit the form "Website encountered an error". Checking the logs
shows the following:

[client ::1:40776] TypeError: Argument 1 passed to Drupal\Core\Field\WidgetBase::massageFormValues() must be of the type array, string given, called in /home/chibuzo/Software/Dev/Src/Web/tpl_website/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 390 in /home/chibuzo/Software/Dev/Src/Web/tpl_website/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 537 #0 /home/chibuzo/Software/Dev/Src/Web/tpl_website/web/core/lib/Drupal/Core/Field/WidgetBase.php(390): Drupal\Core\Field\WidgetBase->massageFormValues()\n#1 /home/chibuzo/Software/Dev/Src/Web/tpl_website/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(232): Drupal\Core\Field\WidgetBase->extractFormValues()```

So if I use '#validated' = TRUE, my ajax callback runs only once and shows the error above on form submit,
And if I remove '#validated'=TRUE, my form fails to submit and shows "You have selected an invalid choice" error".
I even tried to update the $form_state variable to contain the same #options values populated by  my ajax callback and nothing changes, also $form_state->setRebuild(TRUE) does nothing.
I'm almost giving up the idea of using ajax at all, since I've spent more than a week debugging just an ajax select element. First, the ajax callback wasnt being reached at all, now ajax populate happens, but cant submit form. It's just that I have this feeling that I've done 90% of the work involved, its just remaining 1 thing which I dont know. That remaining 10% is what I decided to throw this to the community. I'm sure someone else must know! Thanks for your help, guys...


texts: Limit Migrate explode process plugin to 1 takes whole string

texts:
I have a csv places column with values like that:

Madrid|Spain
Barcelona|Spain

I want to migrate this places to a custom taxonomy and 3 terms (Madrid, Spain, Barcelona) get generated doing it like that:

  field_taxonomy_places:
    -
      plugin: explode
      source: places
      delimiter: '|'
    -
      plugin: entity_generate

But actually I only want to create cities (Madrid, Barcelona), but not countries. So I try to take the first value till the delimiter like that:

field_taxonomy_places:
    -
      plugin: explode
      source: places
      limit: 1
      delimiter: '|'
    -
      plugin: entity_generate

The problem is that now 2 terms get generated (Madrid|Spain, Barcelona|Spain).


texts: User gets first x units of a product free, then has to pay per unit thereafter

texts:
I am wondering if anyone can point me in the right direction. There is only a single product type on my site, however I want every user to get 1000 "point" credit every month. They can buy 1 product for each credit.

I am assuming some kind of checkout system is also necessary, but the payments only have to be through paypal or something similar.

any suggestions?


texts:
I have a content type called "Tips of the Week" and in a Views block. I would like to display one tip at a time, but have it display the next tip in a week's time based on the content's post date. If a tip is added, it is entered into the rotation of the tips.

A tip might not be added every week, so I do not think it can be solely based on the post date of the tips. Instead, is there a way to cycle through the offset.

I have tried different sort criteria, and the closest one I could find was random, but that changes every time the page loads.

How can I accomplish this?

Thanks!


texts:
I'm building a website where you're supposed to add content, which will be unpublished until you click a link in the email you got after adding the content.

So, is there a way to get the publish URL from the content you just added with Token? Or is't possible to get the publish URL whatsoever?

Also, it is an anonymous user that is supposed to click the publishing URL.

Thanks in advance.


texts: Output taxonomy term in views unformatted using twig

texts:
I'd like to output taxonomy terms as html classes for view-rows in the views unformatted template for Drupal 8.

My code:

    {% if title %}

{{ title }}

    {% endif %}
    {% for row in rows %}

             {{ row.content }}

    {% endfor %}

What am I missing?


texts: Is it possible to pass classes to twig include template

texts:
Drupal 9 bootstrap barrio sub-theme.
I would like to use a generic template to build some "card" bootstrap display. This template is called by multiple other templates like this :
{% include '@my_theme/views/views-view-unformatted--card-template.html.twig %}
At begining, I started with this template :
{% if title %}

{{ title }}

{% endif %}

{% for row in rows %}
  {%
    set row_classes = [
      default_row_class ? 'views-row col',
    ]
  %}

    {{ row.content }}

{% endfor %}

But now I see that I must dynamically pass the classes to the template to allow different layouts ("row-cols-1 row-cols-md-2 row-cols-lg-3" or only "row-cols-1 row-cols-md-2" for example).
I saw that we can use the include twig statement with the "with" keyword, so I tried to implement the following :
real template :
{%
  set classes = [
    "card-view",
    "row",
    "row-cols-1",
    "row-cols-md-2",
  ]
%}
{% include '@my_theme/views/views-view-unformatted--card-template.html.twig' with {'card_view_classes': classes} %}

and the generic template :
{% if title %}

{{ title }}

{% endif %}

{% for row in rows %}
  {%
    set row_classes = [
      default_row_class ? 'views-row col',
    ]
  %}

    {{ row.content }}

{% endfor %}

But it don't work. No classes are added.
Maybe someone can point me how to achieve this build ? Or maybe it's not possible to do it like this ?
Thanks in advance for any answer.


texts: Override user/%user page callback for a role

texts:
I have done this by altering the 'page callback' for the path and then checking for the user role in the callback function. I am not sure if this is the best way to go about it.

function mymodule_hook_alter(&$items) {
  // change callback for user view page to our dashboard function
  $items['user/%user']['page callback'] = '_client_dashboard';
}

/**
 * Callback function for menu item user/%
 */
function _client_dashboard($account) {
  global $user;
  // since we override user.module page callback for user/%user
  // perform default function for users without client role
  if(!in_array('client', $user->roles)) {
    // return the function used by user.module passing in account
    return user_view_page($account);
  }
  return t('Dashboard');
}

I know you cannot have logic in hook_menu_alter since it's only called when caches cleared and stored in routing table.


texts: How to fetch submenu items for current page?

texts:
My site nav is all in a single menu: main-menu, eg:

Home
About

Director Name 1
Director Name 2

Contact

My site navigation bar comprises two horizontal strips: the upper one lists all top-level pages (ie: Home, About, Contact, Services). The lower one should be populated with the revelant sub-menu items for the current page. So if you're on the Home page, the bar will be empty. If you're on the About page, the bar will contain links to each of the Directors pages.

My top menu is populated by the following, unchanged from the code in the default page.tpl.php:

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

To get the sub-menu items, however, I've had to add the following to my theme's template.php:

function mytheme_preprocess_page(&$vars){

    $vars['page_submenu'] = NULL;
    $main_menu_tree = menu_tree_page_data('main-menu', NULL, TRUE);
    foreach ($main_menu_tree as $menu_item) {
        if (count($menu_item['below']) > 0) {
            $submenu = $menu_item['below'];
        }
    }
    if ( !empty($submenu)){
        $vars['page_submenu'] = menu_tree_output($submenu);
    }
}

... basically, "get the main menu, find the menu item in it that has some "below" items, and return that "below" bit as a menu tree".

I can then just render that in the template:

print drupal_render($page_submenu);

This seems a bit kludgy. Returning only the submenu items for the current page would seem like a fairly common requirement - is there a better way to do it?


texts: Prevent multiple registrations from the same email using + character

texts:
Gmail and other email services allow users to extend their address using the + (plus) character.
For example, mail to

spamme@gmail.com
spamme+sideways@gmail.com
spamme+tomorrow@gmail.com

will all be receivable by the owner of spamme@gmail.com
In its default configuration, Drupal 7 would allow the owner of spamme@gmail.com to register 3 separate accounts using the 3 addresses above... and more if they want!
I would like to prevent this type of multiple registration.
While I could just create a rule that blacklists email addresses containing the + character, there are legitimate uses of this.
I would prefer to be able to check for other equivalent email addresses, where in the above example, all 3 addresses are equivalent, because they are all collectable by spamme@gmail.com, and allow only one of them.
Is there some way to do that?


texts: How to install drush on a shared hosting without SSH and without composer?

texts:
I would like to install Drush on my shared hosting account in order to let a cronjob call a specific module to this installation.

I have NO SSH access and NO Composer access on this shared hosting account and will not get it neither. I can setup a crontab job and run a call.

I looked extensivly to install drush but cannot find it.

Please do not answer that I should use SSH or composer. These answers will not be helpfull :-)