texts: Dynamically adding a CSS class to a view row with template.php

texts:
I've actually reached the bottom of Google trying to figure out how to add a css class to each row of a view.  The trick is that I need the class for each row to be dynamically determined based on some of the data from the node that the view pulls from.  The function that pulls this off neatly for the node is -

function pgc_preprocess(&$variables) {
  $node = $variables['node'];
  if ($node->type == "event") {
    $variables['event_class'] = '';
    $num_trainers = $node->field_number_of_trainers[0]['value'];
    $count = count($node->field_trainer);
    if($count < $num_trainers) {
        $variables['event_class'] = 'red';
    } else {
        $variables['event_class'] = 'green';
    }
    return $variables;
  }
}

The point of this is to color code an event that hasn't had enough folks sign up.  There will be a list of events on the front page, and I need  them to be color coded also.  I really hope there some simple solution along the lines of -

function pgc_preprocess_views_view_unformatted(&$variables) {
  // Magic here, preferably having something to
  // do with the function I already wrote.
}

Just dropping <?php print $event_class ?> in the view .tpl doesn't do it.


texts: I need to link content from one content type to another automatically so that when one of the type is updated with new content, the other gets filled automatically. Any ideas?


texts:
I have an Angular 6 app living in a subfolder on a D8 installation. I have no issues navigating to the app and the angular routing doing it's thing as I navigate the app. My issues is I get a Drupal 404 if I try to hit the sub routes directly in the address bar.

What do I need to add to my htaccess that will let Drupal ignore the folder and the angular routing still work?

Drupal: localhost:8888

Angular: localhost:8888/my-app

Things I've tried:

Adding: RewriteCond %{REQUEST_URI} !^/my-app/.*$ <- I get Not Found

Changed DirectoryIndex index.php index.html index.htm to DirectoryIndex index.php

Adding the following to httpd.conf:

<Location "/my-app">
 FallbackResource /my-app/index.html
</Location>
<Directory /my-app>
 FallbackResource disabled
</Directory>


texts: Allow users to choose which layout to be applied

texts:
Is there any way to allow users to choose which layout to be applied (Omit the given media queries) for the Omega theme?

For example, ESPN has a switcher for choosing the layout: When browsing in iPad, it has a link to switch to desktop.

Do you have any idea on how achieving such functionality with the Omega theme?


texts: Using the Big Pipe approach for listing pages that are driven by Solr Index

texts:
We are working on a website where we might end up having thousands/lakhs of nodes. So we are planning on using Apache Solr for the listing pages as well.

Having researched a little bit about Big Pipe I was curious if we can use the Big Pipe approach for listing pages that are driven by Solr Index and if Drupal 8 Search/Solr module already supports it.


texts:
I am completely new to drupal. I am trying to customize the Acquia Marina theme to suit my upcoming site. The original layout is as shown in the screenshot:

I want to remove the white band that is the header region and move the logo and title down to the blue band right below it. Basically, have the blue strip function as the header. Is that possible. I have tried removing the header and header-top regions from the info file but that did not make any difference.


texts: get rid of decimal scale of stock field in commerce

texts:
product shows stock as 1.00 -> how do i get it to show 1
(i get this to work in admin lists : admin/commerce/product
but when showing in start screen or product detail page its 1.00..

how can I get rid of .00 ?

notice: I have and create some product and in admin/commerce/products/types/product/fields/commerce_stock  stock field property it is disabled

edited
I update the module to new released , I unnistall fully pervious version and install new, all stock set 0, in display of product display I can do it that dont show scale digits .00, but in edit of product display it is 0.00 with 2 digit scale yet


texts:
How I can have fields for each record of an entity type uniquely?
I have already tried something like this:

$items['admin/structure/basic_example/manage/%/fields'] = array(
    'title' => 'Example fields',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('field_ui_field_overview_form', 'basic_example'),
    'access arguments' => array('administer basic_example entities'),
);


texts: Use the module date-7.x-2.6, to insert a date dd / mm / yyyy in my content type. My problem is that when I view it, would that be translated into Italian for example "22 Settembre 1009" and now appears so: "22 Sep 1009". Thanks!


texts: how to add multiple style values in attribute in drupal form

texts:
I have form element like as follows :

$form['precio'] = array(
  '#type' => 'textfield',
  '#title' => t('Price'),
  '#default_value' => $precio,
  '#size' => 20,
  '#attributes' => array(
    'style'=>'background: none repeat scroll 0 0 #EAEAEA;'
  ),
  '#description' => t('Change the price'),
);

how i add more style attributes to 'precio' ?


texts: Bibilio module will not show saved authors (contributors) on the back or frontend

texts:
I've inherited a Drupal site that is using the Biblio module to save bibliographic records as nodes.

The Biblio module creates a fieldset for "Contributors," these are the authors of the item (books in this case). These contributors get saved to the database when the node is saved but do not show up in this Contributors fieldset on the back end and are not printed on the frontend - the other Biblio fields are printed except for the Contributors. I can not figure out with this is happening.

The site is on Drupal 7.43 with Biblio 7.x.-1.0-rc7 (this is the latest stable version of Biblio 1.0).

Any help on this would be greatly appreciated!


texts:
I just transferred a Drupal 6 website from an Apache-based dev environment to an IIS-based production environment. Now I am getting a "too many redirects" error.

What could be causing that and how do I fix it?


texts: use taxonomy terms as values for radio buttons by code

texts:
I've built a function for select / checkboxes but I can't get it working for radio buttons.

/**
 * helper function to get taxonomy term options for select widget
 * @arguments
 * @return array of select options for form
 */
function popover_get_tax_term_options($machine_name){
    //$options = array( '0' => '');

    $vid = taxonomy_vocabulary_machine_name_load($machine_name)->vid;

    $options_source = taxonomy_get_tree($vid);

    foreach($options_source as $item ) {
        $key = $item->tid;
        $value = $item->name;
        $options[$key] = $value;
    }

    return $options;
}

Calling this in a form hook works with: ( shows all terms )

$form['third']['field_functioncat'] = array(
    '#type' => 'checkboxes',
    '#title' => 'Functiecategorie',
    '#options' => popover_get_tax_term_options('functie_categorie'),
);

But when I call it with radio it doesn't work: ( only shows the title with 1 radio button )

 $form['third']['field_functioncat'] = array(
    '#type' => 'radio',
    '#title' => 'Functiecategorie',
    '#options' => popover_get_tax_term_options('functie_categorie'),
  );


texts:
I am using Views and Views Data Export to create a page of XML data from a specific node type.

The node type has a taxonomy field with unlimited output so that views returns all the selected terms as a comma separated value.

However, I need to output the taxonomy terms as separate XML nodes rather than a comma separated list of one.

So, I currently get this output:

<nodes>
 <node>
  <nid>12</nid>
  <categories>Corporate, finance</categories>
 </node>
</nodes>

I would like to get the following:

<nodes>
 <node>
  <nid>12</nid>
  <categories>Corporate</categories>
  <categories>finance</categories>
 </node>
</nodes>

The difference being that I have two categories fields instead of one.

Can anyone help, please?


texts: Can a Drupal site design (not just colors, fonts, etc -- template stuff) be replicated over multiple drupal sites?

texts:
I will apologize in advance for using the L word...but in Lotus Notes there is the concept of a Template file that holds all the design elements of a database...fields, views, forms, etc. -- has a .ntf extension.  That template can then be used as the design model for other notes databases which have .nsf extensions.  For instance if I have a business model where all my customers do the same thing - say bands keeping track of songs and tours.  I have one bandmaster.ntf file and band01.nsf, band02.nsf, band03.nsf, etc.  The data in each .nsf file is specific to each band...but the design of the database is exactly the same.  Each db inherits it's master design from the one .ntf file.

If I have say a contact form and need to add a new field to it ... say "Alternate Email" -- I open the design of the .ntf file and add that field to my contact form.  Then I 'refresh' the design of all my bandxx.nsf databases and they all now have the new field.

Is there any way to do something like that in Drupal?  Is there a way to export maybe a site's design and use that as the design structure for one or more sites??  I'm just getting started with Drupal.  Thank you for any information.

ER


texts: Let the user add a PDF to a content type, but not as an attachment, content type is the pdf

texts:
I hope the title is a bit clear but this waht I need/want:
At the moment users that have the right to make content can add a PDF for certain content types, this is added as an attachment so users have to go to the content first and then have to click on the PDF to see it.
Is it possible to let my users add only a PDf to a content type and that the content type IS a pdf only?
So when someone goes to that page and clicks the link the PDF is immediately shown
instead of a page in between with an attachment. So this makes it 1 click to see the PDF and not 2.


texts:
I'm developing a site which has 3 levels of taxonomy terms, something like:

Products -> Subcat1 -> Subcat2 -> Item

I've created a view with a page for the taxonomy vocabulary which has a contextual filter configured when a filter value is not in the URL to use the fixed value ''. This page displays the first level of taxonomy terms as expected which is great, however I would like to link the first level to the next level of terms but after 3 days of trying I'm still no closer to figuring it out.

Can anyone shed any light on how this can be achieved? I'm still learning Drupal so it's more than possible I've missed something obvious.

So essentially what I'm after is this:

Top-level page:

Fruits
Nuts
Sweets

Clicking on fruits shows:

Citrus
Non-citrus

Clicking on Citrus shows:

Lemon
Lime

The final page above is a list of actual content items, not taxonomy terms. I hope that makes sense.


texts: How give users ability to change their blog pages theme?

texts: I am using Drupal7 and I am designing a blog engine site that any user can create a blog for him/herself and he/she can change the theme of his/her blog page. Is there any module to integrate with the core blog module and provides this ability for my site?


texts: Hide one form element until another is selected

texts:
Is there any way to disable the field 'model_article_nr' until 'model' is selected

this is what i have and as it is now i can select 'model_article_nr' before i have choosen a model which leads to wrong article nummer if i change model afterwords, because when no model is selected the first model is standard in my '$article_list[$curent_model]' and beeing displayed as options in 'model_article_number'

$model_list = array();
$article_list = get_model_article_list();

foreach($article_list as $key => $value) {
        if ( empty($curent_model) ) $curent_model = $key;
        $model_list[$key] = $key;
    }

$form['model'] = array(
        '#type' => 'select',
        '#title' => t('Model'),
        '#title_display' => 'invisible',
        '#empty_option' => t('Select Model'),
        '#options' => $model_list,
        '#ajax' => array(
            'callback' => 'form_model_callback',
            'wrapper' => 'article-number-ajax-wrapper',
        ),
        '#prefix' => '

',
        '#suffix' => '<button type="button" class="btn tooltip-btn" data-toggle="modal" data-target="#model-help"></button>
',
    );

    $form['model_article_nr'] = array(
        '#type' => 'select',
        '#title' => t('Article Number'),
        '#title_display' => 'invisible',
        '#attributes' => array('placeholder' => t('Article Number'), 'class' => array('space-bottom')),
        '#empty_option' => t('Select Article Number'),
        '#validated' => TRUE,
        '#options' => $article_list[$curent_model],
        '#prefix' => "
",
        '#suffix' => "
",
    );

And my callback

function form_model_callback($form, &$form_state) {
    return $form['model_article_nr'];
}


texts: Problem using tokens when mailing to site owner after an order

texts:
I'm new to drupal

What I want to do:

After a user places an order I want to send an email to the site owner with information of the order. These 2 tokens (that are standard) are working:

[current-user:name]
[message:message-commerce-order:order-number]

I navigate to structure > messages > (here I made a new message) commerce order: order confirmation to admin > edit

path = admin/structure/messages/manage/commerce_order_order_confirmation_to_admin

@ the end of this page I can select tokens

My problem:

When I select a token at the bottom of the edit page and I paste it in my email body, and I actually receive the email, the variable of the token isn't shown. It only gives me the token itself.

For example the token for price doesn't work

[message:message-commerce-line-item:commerce-product:commerce_price]

What am I doing wrong, am I missing some steps?

Do I need to add a rule to the fields of the checkout order steps? But when I choose for shipment it's with radio buttons, so not exactly a field.


texts: Webform with element that has logged in user's username

texts:
In my D8 site i have several webforms created.
I would like to have a Webform element that will pull/prepopulate logged in user's username. Is there a way to achieve that from GUI?

The reason i want that element is that from within Webform Submissions i would like to be able to filter per Username of the user who submitted the webform. This way username will be included in submission data.

By default it allows filtering webform submissions per submission data only or administrative notes.

Thanks


texts:
Is this right? I want to only give access to the people who have 'Download Original' checked in permissions.

function userDownload_menu() {
  $items['user/download'] = array(
   'title' => 'User Download',
   'page callback' => 'user_download_init',
   'access arguments' => array('Download Original'),
   'type' => MENU_SUGGESTED_ITEM,
 );

return $items;
}

If this is correct it's not working for me. Otherwise how can I pass a user role to this?


texts:
I am having problems on an installation I have got from a new client. I have updated to 7.38 hoping for a fix, but it hasnt helped.

Trying to delete fields manually by enabling them on a content type and then deleting them results in a "The website has encountered an error page".

In the field list at /admin/reports/fields there are 20 or so fields that are not used in any content types.

What is the procedure here? Drupal should delete any inactive fields on a cron run, right? I know I can manually wipe them from the database, but id rather work out the problem so it doesnt happen again. Plus the "website has encountered an error" page is unacceptable when an admin is adding and removing fields.

Edit: Warnings from watchdog...

Notice: Undefined index: tabbed_farm_page in field_ui_fields_list() (line 35 of /var/www/website/modules/field_ui/field_ui.admin.inc).

Notice: Undefined index: tabbed_farm_page in _field_ui_bundle_admin_path() (line 325 of /var/www/website/modules/field_ui/field_ui.module).


texts: Adminimal template and CCS adjustments and priority of css files?

texts:
In Drupal 7 i use the adminimal template for some pages.

I want to adjust some element and added therefore a SASV file into the theme.
Now some elements I can override but some elements (like table th) are not going well. Looking into a deeper way I can see the priority of the files:

1 custom.css (with my adjustments)
2 reset.css
3 style.css

So Style.css is applied as last. But style css is not in the info file?!?!

In the adminimal.info file I added:

; ========================================
; Stylesheets
; ========================================
stylesheets[all][] = css/custom.css

How to change the order of this processing ?


texts: How do I filter an entityreference field based on other fields?

texts:
So I'm trying to create a node that has an entityreference to another node. THing is I need that field to filter the data from an entityreference view based on three use cases.

New content. Should only show referenced nodes created by the same user.
Editing created content. Should only show referenced nodes created by the person who created the edited node
New Content as Admin - An administrator/editor should be able to add content under another users name, and it should filter and show nodes created by that user.

I've got 2 out of three but I'm not sure how to get the last one done.


texts: Make GMAP api aware that the gmap has been resized

texts: I'm using jquery and css to toggle my gmap between full screen and normal size. However, since the original height is 200px, when I press the full screen button, it only draws 200px of the map and the rest is covered with a gray color. Is there a way to "let the GMap api know" that the map is resized so that it will draw the rest of the map and center the location selected to the new size?


texts:
Currently, changes are replicated by hands (and rules exports) from dev to a test stage available to the customers. There is actually no live site.

We are going to use the Features module and hook_update_N() in order to deploy the live site.

I wonder what will hapen if I add a feature including some rules already existing on the test stage (created by hand before I got assigned on this project).

Will the rules be overwritten? Will I get errors? I read that updating features files actually updates the rules (or whatever is inside the feature).


texts: How do I list my profile in the profile list after downloading the Drupal distribution with drush make?

texts:
I am creating a profile for my site.

So I basically have the following files:

myproject.info
myproject.make
myproject.profile

Evertime I run

drush make myproject.make

the drupal files + modules are copied but during install I only see the profiles: standard and minimal.

How to make my profile myproject visible in the list?

UPDATE:

I copied my profile inside the profile folder of a Drupal installation.
Now my profile is being listed. But I prefer this should be done from a script.

I asume I should edit the make file to copy the new profile inside the profile folder. I am not sure this can be done from within the make file therefore I assume should run a .sh file instead.

I am waiting for some suggestions.


texts: Add inline JavaScript to end of page dynamically

texts:
Use case:

I have a custom block:

/**
 * Provides a 'Hello' Block
 *
 * @Block(
 *   id = "my",
 *   admin_label = @Translation("My Block"),
 * )
 */
class MyBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {

    $build = array(
      '#markup' => 'SOME WEIRD ADS HTML HERE'
    );

    SOME_COOL_STUFF_TO_ADD_INLINE_JAVASCRIPT_TO_THE_CLOSING_BODY_TAG

    return $build;
  }
}

Is there a way to add inline javascript to the end of the page just when this block is rendered anywhere (in theme or panel page)?


texts: How do I add an autocomplete to a form element that is not an entity reference?

texts: I need to add a auto complete text field in my custom form module. The auto complete values should be retrieved from the database table. Can anybody tell me how to do that?


texts: using EntityFieldQuery, how to order results based on a node reference field title and/or field collection item field, says name

texts:
I have a node which references another, I want to order the results based on the title of the referenced field title.

I'm using

function listAll(){
  $query = new EntityFieldQuery();
  $entities = $query->entityCondition('entity_type', 'node')
                    ->entityCondition('bundle', 'building')
                    ->fieldOrderBy('field_reference_area', 'title', 'ASC')
                    ->execute();

  $nodes = entity_load('node', array_keys($entities['node']));

  foreach($nodes as $key => $fac){
      dsm($fac);
  }
}


texts:
I'm trying to change the phone number displayed in sidebar window with the chinese lady in it. However I'm trying to find out where it's content is coming from.

This is how the HTML looks

    <?php print variable_get('yingyang_online_title1');?>
    <?php print variable_get('yingyang_online_title2');?>
    <?php print variable_get('yingyang_online_phone');?>

    <a class="onlineConsultation yyModChatLink" href="<?php print url('customer-contact-request') . '?width=790' ?>">

and the thing I need to change in particular is <?php print variable_get('yingyang_online_phone');?> but I can't find where yingtang_online_phone is set.

do you guys have any ideas where to look?


texts: Limit a user to edit AND view only a specific content type?

texts:
I have a role dedicated to creating and/or editing a specific content type.  It is the only activity to be allowed for this role.

I have set up login destinations module to go to the content overview and it pretty much works fine.  Users can only edit the allowed content type and when they add content, they immediately get the content type they are allowed to use.

The issue is that I want the user in this role to ONLY see the content type they are allowed to modify.  Currently, it lists all the nodes, which will be confusing for the folks using this role.

Any ideas on a way to use the content overview screen and limit the nodes viewable?

Thanks in advance.


texts: Textarea for Drupal 8 text fields content types

texts: Currently there is no option to select textarea as a widget for a long text field in a content type. What solutions are there? And why was this removed as this was in core Drupal 7.


texts: Create URL aliases for Entityform submissions

texts:
I have the Entityform module installed on a Drupal 7 portal and I've created a new entityform type (let's call it "Preview").

When I land on the list of "Preview" submissions, each submission View link points to [host]/[drupal_base]/entityform/[entityform_id]

What I'd like to get is to change "entityform" term in that url path with something like "preview" term, so that I'll have [host]/[drupal_base]/preview/[entityform_id]

I tried to define a URL alias from the admin configuration panel, but from what I've understood, I can't define an alias with a dynamic [entityform_id] (maybe using a kind of placeholder). Am I wrong about this?

I'm not so skilled in Drupal, so I wonder if there's a way to achieve that result?


texts: Change the order of product variations on the "add to cart" form

texts:
I have a product type with three variations (to make this simple, let's assume it's a t-shirt store):

Color
Size
Team

On the "Add to Cart" form (configured at /admin/commerce/config/order-item-types/default/edit/form-display/add_to_cart), I have Purchased entity set to Product variation attributes.

This displays three dropdown menus that let me select the values for Color, Size, and Team.

How do I change the display order of these menus (for example: change the order to Team, Color, Size)?

Drupal 8/Commerce 2


texts:
I have installed Views Slideshow module 7.x.3.1.  Also, inside the sites/all/libraries I downloaded the cycle2 plugin.
I placed jquery.cycle2.min.js into the jquery.cycle2 folder, so it is at sites/all/libraries/jquery.cycle2/jquery.cycle2.min.js.

When I tried creating a view using Format : slideshow, I encountered the following error:

  CYCLE OPTIONS You need to install the jQuery cycle plugin. Create a
  directory in sites/all/libraries called jquery.cycle, and then copy
  jquery.cycle.all.min.js or jquery.cycle.all.js into it. You can find
  the plugin at http://malsup.com/jquery/cycle.

Even after installing the cycle plugin in the libraries folder, I could not see an option for cycle2.

Along with with views slideshow, I need  pager effect and continuous effect, with vertical effect instead of horizontal effect.


texts: Bug or a feature: drupalSettings array is not merging anymore?

texts:
I have just noticed that when I use

$form['#attached']['drupalSettings']['foo']['bar'][] = microtime();
// or...the depth does not matter
$form['#attached']['drupalSettings']['foo'][] = microtime();

multiple times with different values I end up only with one value being present in DOM. So for some reason Drupal 8 no longer renders the array properly. When I use specific keys, all values are present in DOM.

Is this a bug or a feature? I haven't noticed this behavior in the past 3 years so far so I am not sure if this is API change or not. I am specifically not using keys since I want the result to be array, not object.

I would assume this is an issue with NestedArray:mergeDeep() ?


texts: Getting "Page Not Found" After Enabling the Devel Module Drupal 7

texts:
I'm trying to install the Theme Developer which requires the Devel module.

I've downloaded the Devel module via the Install new Module page in Drupal. When I enable the module however, I get redirected to a "Page Not Found" error.

Going to Reports > Recent log messages shows:

page not found  06/14/2017 - 10:23  modules/statistics/statistics.php
page not found  06/14/2017 - 10:23  modules/statistics/statistics.php
php 06/14/2017 - 10:22  User warning: The following module has moved within...
php 06/14/2017 - 10:22  User warning: The following module has moved within...
php 06/14/2017 - 10:22  User warning: The following module has moved within...

The three PHP messages complain that devel_node_access, devel, and devel_generate have all been moved.

Could this be some form of permission issue?

Edit:
I just tried again, but this time used a different theme. Devel was still not enabled, but I was redirected to a different page; /q=admin/modules&filter=devel&enabled=1&disabled=1&required=1&unavailable=1. Now I can't view any of my site. I rebooted my VM but my site is still unresponsive. Looks like enabling Devel has broken my site somehow.

Edit 2:
Destroyed and rebuilt my VM. This time I did not change the theme to my custom theme, and instead left the default theme enabled. I refreshed all caches, and attempted to enable Devel (I didn't have to re-download anything since the modules were still in my VM directory). This time it worked! Devel is now enabled. I'm not going to write an answer to this until I know exactly what changed and why it's now working fine.

Edit 3:
After enabling Devel, SimpleHTMLDom Api, and Theme Developer, I now see the following error on any of my pages.


texts: Drush 8 / Drupal 8 fatal error class not found exception AccountInterface

texts:
I have a Windows 10 PC, using git-bash as terminal window to run drush. Drush is installed in c:\users\myname\appdata\roaming\composer\vendor\drush\drush.

My apache server (using xampp) is on the d drive. When I am in d:/xampp/htdocs/ I can run drush in the terminal just fine (drush dl honeypot works perfectly). If I cd another level to d:/xampp/htdocs/dev1 and try to run drush I get this error:

  Fatal error: Class 'Drupal\Core\Session\AccountInterface' not found in
  D:\xampp\htdocs\jbcg\core\includes\bootstrap.inc on line 58 Drush
  command terminated abnormally due to an unrecoverable error.
  [error] Error: Class 'Drupal\Core\Session\AccountInterface' not found
  in D:\xampp\htdocs\jbcg\core\includes\bootstrap.inc, line 58 PHP Fatal
  error:  Class 'Drupal\Core\Session\AccountInterface' not found in D:\xampp\htdocs\jbcg\core\includes\bootstrap.inc on line 58

If I cd back up a level to htdocs, I can execute the command just fine. Anyone have any idea what is going on?

Thanks,
Jim


texts: Views Infinite Scroll and back button issue

texts:
I am using Views Infinite scroll module, Drupal 7. When i click on an item and go to next page and then click Browser back button, it takes me back to the start of the page.

When i click browser back button, i want the user to go back where he clicked/ or where he was on the previous page

Can somebody suggest any solution to this? Or any other module that can be used? Or an jquery script that would help?

I am badly in need of help.Thanks in advance!


texts:
I am trying to have one tpl file per view mode inside a module folder. But I can't get drupal to pick up the right tpl file.

I have been trying solutions on these pages:

http://www.metachunk.com/blog/adding-module-path-drupal-7-theme-registry

/**
 * Implements hook_theme_registry_alter()
 **/
function nwd_press_room_theme_registry_alter(&$theme_registry) {
    global $theme_key;
    $mod_path = drupal_get_path('module', 'nwd_press_room');
    $theme_registry_copy = $theme_registry;       // munge on a copy
    _theme_process_registry($theme_registry_copy, 'phptemplate', 'theme_engine', $theme_key, $mod_path);
    $theme_registry += array_diff_key($theme_registry_copy, $theme_registry);
    $hooks = array('node');

    foreach ($hooks as $h) {
        if (!isset($theme_registry[$h]['theme paths'])) {
                $theme_registry[$h]['theme paths'] = array();
        }
        nwd_press_room_insert_after_first_element($theme_registry[$h]['theme paths'], $mod_path);
    }

    dpm($theme_registry);

}

/**
 * Helper function for re-ordering arrays (needed by theme_registry_alter)
 */
function nwd_press_room_insert_after_first_element(&$a, $element) {

    if(is_array($a)) {
        $first_element = array_shift($a);
        if ($first_element) {
            array_unshift($a, $first_element, $element);
        } else {
            array_unshift($a, $element);
        }
    }
}

Since I still want the tpl file to be overridable in the theme. Does anyone have an example that works?


texts: Understanding the 'node' string in a Views SQL Query

texts:
I'm trying to understand this Views SQL Query:

    SELECT node.nid AS nid, node.title AS node_title, 'node' AS
field_data_field_icon_node_entity_type, 'node' AS
field_data_field_price_node_entity_type, 'node' AS
field_data_body_node_entity_type
    FROM
    {node} node
    INNER JOIN {field_data_field_type} field_data_field_type ON node.nid =
field_data_field_type.entity_id AND (field_data_field_type.entity_type =
'node' AND field_data_field_type.deleted = '0')
    WHERE (( (node.status = '1') AND (node.type IN  ('resource')) AND
(field_data_field_type.field_type_value = '4') ))
    ORDER BY node_title ASC
    LIMIT 10 OFFSET 0

Specifically, I need to know what the line in the SELECT statement that says 'node' AS field_data_field_icon_node_entity_type means.

I see in the database I have a field called 'field_data_field_icon' but not with the rest of the jargon attached to it. So I'm not sure how it's getting that data.

Anyone know?


texts: Add programmatically created field to content type form

texts:
I've programmatically created a content-type with 3 fields (in D8).

The fields are created but do not show up on node creation. If I go to the content-type form display, the fields are there, but I need to save this page to get the fields to show up on node creation.

The content-type and fields are created in yml-files and the Looks like this:

config/install/field.field.node.slideshow_slide.slide_weight.yml

langcode: en
status: true
dependencies:
config:
    - field.storage.node.slide_weight
    - node.type.slideshow_slide
module:
    - text
enforced:
    module:
        - custom
id: node.slideshow_slide.slide_weight
field_name: slide_weight
entity_type: node
bundle: slideshow_slide
label: 'Weight'
description: 'This slides weight'
required: false
translatable: false
default_value: 0
default_value_callback: ''
settings: { }
field_type: string

config/install/core.entity_form_display.node.slideshow_slide.default.yml

langcode: en
status: true
dependencies:
config:
    - field.field.node.slideshow_slide.slide_image
    - field.field.node.slideshow_slide.slide_link
    - field.field.node.slideshow_slide.slide_weight
    - node.type.slideshow_slide
module:
    - image
    - link
id: node.slideshow_slide.default
targetEntityType: node
bundle: slideshow_slide
mode: default
content:
slide_image:
    label: visible
    weight: 101
    settings: {  }
    third_party_settings: {  }
slide_link:
    label: visible
    weight: 100
    settings: { }
    third_party_settings: {  }
slide_weight:
    label: visible
    weight: 100
    settings: { }
    third_party_settings: {  }
links:
    weight: 100


texts: How to delete nodes without taking a lot of time?

texts: My site has about 200 000 nodes. When I want to delete let say 200 nodes it takes about 2hr. I have also installed commerce module, views and a lot of the usual modules. What can I do to speed things up?


texts:
I am using private message module.

When i load the private message page  i am getting 3 tabs

Inbox

Sent messages

Write new message

In this i need to change the inbox url from /messages to /messages/inbox.

How can i do that ?

Note  : Not using jquery is not the right way i think so for this scenario

Thanks in adavance..


texts: Why doesn't the option "User:roles"  show in "Contextual Filter"?

texts: I can't see the option "User: roles" in the contextual filter, and when I select "Relationships" I don't see "User Roles".  What happens?


texts: How to filter view to pull based on a shared field through taxonomy terms?

texts:
We have a two content types: page and article.

Page has 1 field instance field_tag1 that has 10 values. field_tag1 has two separate instances on the article content type (field_tag1_primary and field_tag1_secondary) as taxonomy terms.

Essentially, field_tag1_primary and field_tag1_secondary essentially map to the field_tag1 field instance.

Example of how the relationship work is below.

field_tag1 term values (examples)

val1
val2
val3
val4

Basic page1

field_tag1 = val1

Article page1

field_tag1_primary = val1

Article Page 2
 2. field_tag1_secondary = val1

In the example above, article page 2 and page 1 both are linked to basic page 1 because the field_tag1_primary and field_tag1_secondary values are val1. We have placed a view on the basic page1 that has the following criteria that needs to be meet.

Criteria ("or" condition):
1. if article page1 field_tag1_primary =  basic page1.field_tag1, then return articlepage1
2. if article page2 field_tag1_secondary =  basic page1.field_tag1, then return articlepage1

Current view filters:
1. relationship = where field_tag1 has a value and exists

What we tried that did not work:
1. added contextual filter to take in nid


texts: I am using a module (donate) that produces a form at a specific URL, for example, http://example.com/donate. I would like to put this form inside a block and display it on another page. Do you guys know the best way to do this? Thanks for reading.


texts: Group similar strings in translation interface?

texts: I have a couple of menus with same options inside like "Add new order" for different client types. So when I want to translate this only one string "Add new order" drupal 7 offers somewhere around 7 translation possibilities with different contexts. Does exist any possibility to group those string in one?


texts:
My images are not displayed in block and attachment page,but displayed in the content
i check the views but don`t fixed i do anything with views and check permissions but not fix my problem.
Of course this problem when upload site from local to server is showing up. tnx.

what can i do ?? help


texts: How will speed be affected by entity_metadata_wrapper()?

texts:
I'm building a big website and I'm using entity_metadata_wrapper() in lots of places around the website.

I'm wondering how this will affect the website's speed and server resources.

Thanks


texts: Drush does not acknowledge release of new core update

texts:
I am trying to update my drupal 7.31 core to 7.32 via Drush.

I ran the following commands

$ drush pm-releases

Project  Release  Date         Status
drupal   7.x-dev  2014-Oct-15  Development
drupal   7.32     2014-Oct-15  Supported, Recommended, Security
drupal   7.31     2014-Aug-06  Security

After the above command i ran the following:

$ drush pm-update drupal

Update information last refreshed: Thu, 10/16/2014 - 07:33
 Name    Installed Version  Proposed version  Message
 Drupal  7.31               7.31              Unknown

No code updates available.

so i ran the following command:

$ drush pm-update drupal-7.32

Update information last refreshed: Thu, 10/16/2014 - 07:33
 Name         Installed Version  Proposed version  Message
 drupal-7.32  Unknown            Unknown           Specified version not found

No code updates available.

Here are the versions for drush and composer. Both are to the latest versions.

$ drush version

 Drush Version   :  7.0-dev

Composer version 1.0-dev


texts:
I am using Commerce Userpoints to award points based on purchases and then customers can use those rewards on future purchases for a discount.

I'd like to customize the checkout pane if the user has already applied a discount. Commerce Userpoints Discount creates a line item type of userpoints. My initial idea was to check if the current order contains a line item of type userpoints, but I'm not sure how to do that. Any help would be appreciated!


texts: How do I programmatically set contextual filters?

texts:
I need to set a contextual filter programmatically and almost every view I have will have this filter. However, some wont and will have other contextual filters instead.

I have tried following the examples in here but this will just set the first argument to be my filter value regardless of what field is it for.

In views_pre_build I get the keyed arguments list under $view->argument and can do ->setArgument() but this doesn't change the set of results.

Is there an easier way of setting a specific contextual filter?


texts: _preprocess_views_view__ specify view name

texts:
I have a view named "taxonomy_term_custom." The preprocess code below works to do some specific stuff for this view, but I would like to override the hook like this:

function mywebsite_glue_preprocess_views_view__taxonomy_term_custom(&$vars) {
}

Is this possible?

function mywebsite_glue_preprocess_views_view(&$vars) {
  if($vars['view']->name == 'taxonomy_term_custom'){
    dpm($vars);
    // do stuff
  }
}


texts: Is it possible to accidentally enable all views at once?

texts:
I found all views enabled on a client site. Is it possible to enable all views at once?

Disclaimer: I did a module and core update with drush two days ago, but didn't look at the views list.


texts: Control fields of views on different pagination

texts:
I use pager (as 1 2 3.. 9 >>Next >>Last) in a views and displaying only 3 articles on one page with the fields title and body.

I need to hide body of the articles on 3-6 pages.

Note: It should be done by only using views or views handler but not with css or JS.

Kindly guide me to do that.

Thanks


texts: Trying to add an html head tag in Drupal 8, beta 2

texts:
With Drupal 8.0 beta2, drupal_add_html_head() has been deprecated in favor of #attached. So the old way was:

function MYTHEME_page_build(&$page) {
    $viewport = array(
          '#type' => 'html_tag',
          '#tag' => 'meta',
          '#attributes' => array(
            'name' => 'viewport',
            'content' => 'width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=0.55, user-scalable=yes',
          ),
        );
        drupal_add_html_head($viewport, 'viewport');
}

Based on the change notice you now use #attached. So the code above is essentially the same with the last part changing to:

$build['#attached']['html_head'][] = [$viewport, 'viewport'];

This does not work though and no error messages in watchdog. I've also tried putting this in a page alter as well as swapping $build with $variables and $output but it still does not work. In addtion, I tried the entire thing as an array:

  $build['#attached']['html_head'][] = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'viewport',
      'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no',
    ),
  );

... but that did not work either. I am not sure what I am doing wrong, seems like it should be working.

Update

Here is working code which uses hook_page_attachments_alter which is not in D8 Beta 2 as it was just committed to dev.

function MYTHEME_page_attachments_alter(array &$page) {
    $viewport = array(
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'viewport',
        'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no',
      ),
    );
    $page['#attached']['html_head'][] = [$viewport, 'viewport'];
  }

The only issue now is that core's viewport tag does not get overwritten so I am stuck with my custom tag and core's. Not sure how to handle that one or should my tag be overwriting core's?


texts: How to create a redirect to point to the user's id?

texts:
I'd like to create a redirect so when the user hits mydrupal.com/my-account its redirected to mydrupal.com/users/3

I'm using Pathauto and I know I can go to admin/config/search/path/add to add the redirect but I can't get it to point to the user id as variable. For instance, in the existing system path option I thought I could add users/[uid] but that didn't work.

Any suggestions?


texts: Sorting in views not working for drupal commerce products

texts:
In the product views of my drupal commerce site, I want to list the products sorted by amount(price).

The product has 4 categories. They are added as relationships in the view:

Now to sort them by price, I am doing the following:

This is working perfectly fine in another view where I am using Contextual filters(Product category).

But in this view, where I am displaying products of all categories, the sorting is not working.
What is happening in this case is:

First all the Poultry items are coming in sorted(by price) order.
Then all the Fish items in sorted(by price) order.
And so on.

What I want is :

All Items should be collectively sorted by price.


texts: why the search result shown in default language only ?

texts:
i have a multilingual site with 2 languages and i have a search view , the search view works well in (english) and give me the result but when am changing the language to the second one ( arabic ) its give me the same result that i want but in english !!

English version:

Arabic version:

any suggestion to solve this problem ?


texts: How to trigger email, account/user and order creation actions when payment is made in paypal, not when user is redirected back

texts:
I have read many discussions of this sort, but just couldn’t get my head around this issue.

I am testing my site locally and using paypal WPS as my module to process payments. As default, when my users are directed to paypal and makes the payment, they are not re-directed back to my site unless they click one of the paypal links to be redirected back and as a result no user account is created, no order is recorded and no order/welcome emails are fired, unless the user goes back to my site, which I do not want.

So I went to rules and replaced all the ‘Completing the checkout process’ events with ‘When an order is first paid in full’ events, so that I can have all the above actions triggered as soon as the payment is first made on paypal, but unluckily none of these rules are now working and I assume it’s because I am not receiving IPNs on localhost. I did look into the logs.

Here’s a quick list of questions I would need your advice on.

Q1. Am I really having these issues because of not receiving the IPNs in localhost. The way I looked for IPN was by looking into the admin>reports>Recent log messages. Please let me know if it’s the correct way?

Q2. If that is the reason, do I have to put my site live to test the IPNs. It might be a silly question but what if my users attempt to make payments while I my site is live and still in a test phase. Is there a way I can test this all locally first.

I hope it has nothing to do with rules and replacing all the ‘Completing the checkout process’ events with ‘When an order is first paid in full’ events is the right move to create accounts, orders and send emails when the payment is made, rather than when the user comes back to the site.

I am using xampp stack and paypal sandbox account to test my site.


texts: How can I delete a row from the database?

texts:
I would like to delete all rows from the database that is older than 1 month. How can I do that in Drupal 8?

  DELETE FROM myTable WHERE MyColumn < DATEADD(MONTH, -1, GETDATE())


texts: How to create Simple View & Responsive View & linkup with one link in drupal 7?

texts:
I am working on a commerce site (Already developed). I have seen that :

Two views are there i.e. Product Company Accordion View & Product Company Slideshow View. Both the views holds the same data. When the link mysite/dis/product  opened in Desktop Product Company Slideshow Views shows & when the same link mysite/dis/product opened in any mobile then Product Company Accordion Views shows.

I have checked these Views.

In Product Company Accordion View

Format : Views Accordion

My question is that how they apply condition with same link opened with multiple view with multiple platform.

Please help. Thanks


texts: user warning messages keep popping up even after uninstall

texts:
I have recently disables, uninstalled and removed a few modules from my drupal 7 site but this error keeps popping up no matter what I do, I have researched how to remove them but to my dismay nothing, please help.

User warning: The following module is missing from the file system: admin. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1138 of /opt/lampp/htdocs/drupal/includes/bootstrap.inc).


texts: Programmatically embed fields of one content type in the create/edit form of another content type and store all

texts:
I have drupal 6.x.

How to programmatically (with a custom module) embed fields of one content type (content type X) in the create/edit form of another content type (content type Y) and store all the data for when the node is created/updated (store X and Y data when Y is stored).

If is not possible this in drupal 6.x I could be to work in drupal 7.x.

Thanks in advance.


texts: Can I add text to a form file upload field?

texts:
Is it possible to add text/markup to a file upload field similar to the image below?

I thought that something like

$form['actions']['edit-field-upload']['#prefix'] = 'First';

in a hook_form_alter would work, but don't see anything.


texts: How do I redirect users to the page they were before logging in to my site?

texts:
I´ve got a Drupal site that after the user logs in it is redirected to his profile.
I want to create a specific rule so people from specific characteristics can retur to the page they were before they´ve logged in.

I´m planning to do that with the rules module.

So, I´ve set the parameters and conditions, but when I try to create the rule, telling Drupal where it should redirect people, I just don´t know how to say that.

I think I should put some php code inside that page redirect rule, but don´t know how.
Hopw you can help me out.

FYI, I've tried (unsuccessfully) this:

$_SESSION['redirect_to'] = $_SERVER['REQUEST_URI'];
header("Location: http://www.mysite.net/user");
exit();

// On successful login
$redirect = $_SESSION['redirect_to'];
// unset the session var
unset($_SESSION['redirect_to']);
header("Location: http://www.mysite.net/$redirect");
exit();


texts:
This is my first Drupal 8 site but I have been building Drupal sites since Drupal 6. I am getting lots of Uncaught TypeErrors in the JavaScript console that I can't figure out. I have spend hours searching and have not found an answer. What am I missing?

I am developing a custom theme. The site is on Mamp. Any insight would be helpful.


texts: How to use service renderer with context theme?

texts:
I have snippet code:

//Load block view (have override template)
$block = Block::load('views_block_1480647185');

// get render array
$render = \Drupal::entityTypeManager()
  ->getViewBuilder('block')
  ->view($block);

// get markup string
$markup = \Drupal::service('renderer')
  ->render($render);

kint($markup);

when i visit different url admin (example.com/admin/content), non-admin (example.com). Value markup is different.

In example.com/admin/content

In example.com (use override template view)

I think because url use different theme (bartik and seven).

So how can set markup value same value in url non-admin? How can do that with drupal service renderer?


texts:
I am working on a module that needs to send push notification through FCM, I use Firebase Push Notification (FCM) for this purpose and it works well.

So what I need to do is to send a push notification when a node of specific content type is created, and it's solved through hook_entity_insert, but problem is that I have multiple languages on site, and it works only when the node is created the first time.

So my question is how to know when translation is created for the first time for a specific node?

For example:

node is created on English (in hook_entity_insert I check if the node
belong to specific content type and call a function to send the notification to all users that have English as user language).
now when we add the translation for other languages, how I can know that it's the first time translation is created, and not updated one?


texts: add_where() causes the view not to be displayed

texts:
have a page that features a few views based on content types. Each content type includes a keyword field. This page is reached from a short quiz. I'm trying to limit the content in the views based on responses in the quiz by pulling the $_POST data and comparing it to the keyword field. The code is executing, and I'm fairly sure I have the join right, but instead of limiting the content to matching keywords, the entire display block just disappears.

Here is my module code:

<?php

if (!empty($_POST["q1"])) {

    $q1 = $_POST['q1'];
    $q3 = $_POST['q3'];

    /**
     * Implements hook_views_query_alter to add a where clause to the views queries
     */
    function iamru_keyword_filter_views_query_alter(&$view, &$query) {

        global $q1, $q3;

        if ($view->name == 'iamru_prepared_statement') {
            $query->add_table('field_data_field_keyword');
            $query->add_where(1,'field_data_field_keyword.field_keyword_value', $q1, '=' );
        }

        if ($view->name == 'iamru_word_for_you_view') {
            $query->add_table('field_data_field_keyword');
            $query->add_where(1,'field_data_field_keyword.field_keyword_value', $q3, '=' );
        }

    }

}

Can anyone see where I've gone wrong here?

Interesting update: If I replace $q1 with 'somekeyword' in the add_where call, it actually works.


texts: I am trying to expose specific drupal blocks that are core blocks and system blocks, like language switcher block, site branding, title, tabs, status message. Is this even obtainable by json:api or all of this blocks out of scope as they are not entities  and how should we fetch then language switcher and build it in JS frontend?


texts: How to get the parent entity title inside image.html.twig

texts:
I want to get the node title inside an image.html.twig override so I can use it to replace the 'title' and 'alt' attributes of the image.
So far I was able to pass simple variables with THEME_preprocess_image(&$variables) but no luck getting the title of the parent node.


texts: I want to make node views "Edit link" field as a menu

texts:
Is it possible to make "Edit link" field as a menu.
On my site one user can create only node and I have a page view which displays the node the user logged on has created.
This views has a "Edit link" field so that the user can jump to node edit page from this view page.

However I want to have a menu or tab that can directly link to the node edit page of the node the logged in user has created.
It should a menu or a tab that says "edit my node" and the user can directly jump to the node edit page without visiting the page views.


texts: Does anyone know how I can alter what is displayed in the tooltip shown when hovering over the username and password text on the login screen?


texts:
I am using pager_query and theme_pager function as below.But unfortunately the pager is not getting displayed.Please help.

function advanced_product_search() {
    $output = "";

    $sectors = $material_types = $resource_types = array();
    $where_array = array();
    $node_data = array();
    $product_query = "SELECT n.* FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid ";
    $product_count_query = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n
        INNER JOIN {term_node} tn ON n.nid = tn.nid ";

    $product_query .= " WHERE n.type = 'product' ";
     if(isset($_POST['keyword']) && !empty($_POST['keyword'])){
        $key_word = check_plain($_POST['keyword']);
        $product_query.= " AND n.title LIKE '%$key_word%' ";
        $product_count_query.=" AND n.title LIKE '%$key_word%' ";
    }

    if(!empty($_POST['sector'])){
      $sectors = $_POST['sector'];
    }

    if(!empty($_POST['material_type'])){
      $material_types = $_POST['material_type'];
    }

    if(!empty($_POST['resource_type'])){
      $resource_types = $_POST['resource_type'];
    }

    $terms = array_merge($sectors ,$material_types ,$resource_types);
    if(!empty($terms)){
      $count = 1;
      $terms_list = "";
      foreach($terms as $tid){
        if($count < count($terms)){
          $terms_list.="$tid,";
        }else{
          $terms_list.="$tid";
        }
        $count++;
      }
      $product_query.=" AND tn.tid IN ($terms_list)";
      $product_count_query.=" AND tn.tid IN ($terms_list)";
    }

    $product_query.=" GROUP BY n.nid ORDER BY n.changed DESC ";
    $product_count_query.=" GROUP BY n.nid ORDER BY n.changed DESC ";

    $product_array = array();
    $product_query_result = pager_query($product_query, 5, 0, $product_count_query);
    while ($node = db_fetch_object($product_query_result)) {
      $node_data = node_load($node->nid);

      if($_POST['accredited'] == 'on'){
        if(empty($node_data->field_right_way_accredited[0]['value']) || !$node_data->field_right_way_accredited[0]['value']){
          continue;
        }
      }

      $product_array[] = array(
        'nid'=>$node_data->nid,
        'title'=>$node_data->title,
        'price'=>$node_data->sell_price,
        'image'=>$node_data->field_image_cache[0]['filepath'],
        'url'=> $node_data->path
      );
    }

    $output .= theme('ssa_product_search_template', $product_array);
    $output .= theme('pager', NULL, 5, 0);
    return $output;
}


texts: How to use drupal_get_form outside of a menu

texts:
I am trying to use the drupal_get_form funtion outside of a menu and am not having any luck finding examples of how this is done.

An overview of what I am trying to achieve is:
1) Pass control from a script using an href html tag passing to another script that will then read what has been passed to the new script and build a form based on the action that has been passed in. I am using the drupal_get_form function just as you would any php function.
2) I am also getting a message that says drupal_get_form is an unknown function.

This script is the initial calling script that contains an html href link to the called processing script.

function view_payment_methods() {
  try {$result = db_select('tls_connect_cashier_payment_methods', 'q')
    ->fields('q', array('id', 'payment_method', 'payment_desc', 'logically_deleted', 'system_or_user'))
    ->orderBy('payment_desc')
    ->execute();
  } catch(Exception $e) {
    watchdog_exception(
      'view_payment_methods',
      $e,
      'Select from tls_connect_cashier_payment_methods has failed.',
      null,
      'Alert'
    );

    return false;
  }
  $payment_methods = $result->fetchAll(PDO::FETCH_ASSOC);

  $col1_label           = t('Payment Method');
  $col2_label           = t('Payment Description');
  $col3_label           = t('Disabled');
  $col4_label           = t('Created By');
  $col5_label           = t('Action');
  $edit_label           = '(' . t('Edit') . ')';
  $delete_label         = '(' . t('Delete') . ')';

  $markup  = "
" . t('Payment Methods') . "
";
  $markup .= "
";
  $line    = "
";
  $line   .= "" . $col1_label . "	";
  $line   .= "" . $col2_label . "	";
  $line   .= "" . $col3_label . "	";
  $line   .= "" . $col4_label . "	";
  $line   .= "" . $col5_label . "	";
  $line   .= "
";
  $markup .= $line;
  if (isset($payment_methods[0])) {
    foreach ($payment_methods as $entry) {
      $disabled          = '';
      $created_by        = '';
      $id                = $entry['id'];
      $payment_method    = $entry['payment_method'];
      $payment_desc      = $entry['payment_desc'];
      $logically_deleted = $entry['logically_deleted'];
      $system_or_user    = $entry['system_or_user'];
      $line              = "
";
      $line             .= "" . t($payment_method) . "	";
      $line             .= "" . t($payment_desc) . "	";
      if ($disabled == 0) {
        $disabled      = 'No';
      } else {
        $disabled      = 'Yes';
      }
      $line             .= "" . t($disabled) . "	";
      if ($system_or_user == 'S') {
        $created_by    = 'System';
      } else {
        $created_by    = 'User';
      }
      $line             .= "" . t($created_by) . "	";
      $line             .= "" . $edit_label . "
                        " . $delete_label . "	";
      $markup           .= $line;
    }
  }
  $markup .= "
";

  return $markup;
}

This script is the called script accessed by way of the html href link for the edit link.

if (isset($_GET['action'])) {
  $id = $_GET['id'];
  switch ($_GET['action']) {
    case 'edit':
      $form_id = 'edit_form';
      return drupal_get_form($form_id);
      break;
    case 'delete':
      break;
  }
}

function edit_form($form, &$form_state) {
    global $id;
    die('chuck');
    $form = array();
}


texts:
I am having a content type with fields select list, js, css, and body. In the select box it list a number of templates to apply on the current node. I have these custom templates in the templates folder of the active theme, in the format my-module-blank.tpl.php, my-module-custom1.tpl.php

And on select list I have blank and custom1 as options. In the hook_preprocess_node, using theme_hook_suggestions I have did the same,

  $variables['theme_hook_suggestions'][] = 'my_module_' . $field_template_list;

But it is not taking the template, In addition I need to use hook_preprocess_html
to include the custom css and js added to fields of content type to the header portion. I didn't find any proper documentation on it.

Please show me a better documentation so that I could implement.


texts: What methods are there to load more ROWS into a View display without reloading the page?

texts:
I have a basic View showing 2 node teasers at a time. I want to be able to have a button below it that says load more. Once you click it, it will load the next two. I know that there is the module "views_load_more", but there seems to be a bug with that module that causes duplicates. There is a patch for this issue, but it doesn't solve the problem from what i have tried.

I was wondering what other modules or methods to achieve this same functionality?

I was thinking of continuing to use the views load more module, and just use jquery to detect if there are duplicates and then remove them. But that way seems to be a bit hacky.


texts: Drupal 7 profile2 pages not display profile

texts:
this is my problem:

I am using Profile2 Pages Module on Drupal 7.17, it's a test
application with a fresh installation and only the listed modules installed.

Using the default Profile2 profile that come with the module ( its name is Main Profile ),
When i remove permission to the Authenticated user to edit his Profile2 Main Profile: own profile the user
lose access to his own -profile2 page Main profile- , both the menu link and the permission to access the node get lost

this does NOT happen when the -profile2 Main profile- is displayed together with the user My account page

( you can achieve this by unchecking the "Provide a separate page for editing profiles." chkbox in Home » administration » structure » Profile types )

All dependencies are respected ( entity API >> profile2 >> profile2 pages )

i even tried by checking the chkbox in USER >> View user profiles   for the Authenticated user in Home » Administration » People  but no changes at all

Any advices is welcome, thanks.


texts: How to validate an AJAX form which uses CTools?

texts: I have a form which opens in a modal CTools window. The forms submits perfectly, but when I try to use the my_form_validate() function, it never goes to that function, it always go directly to my_form_submit() function? I have tried to "uncode" the CTools modal windows example provided with the module, but I am not able to decipher it.


texts: How can I allow only friends to see a specific user field?

texts:
I want to make a simple social network website using Drupal 7. There will be a relationship type like 'friendship', based upon the User Relationships module.

After a lot of Googling, I haven't found any way to forbid non-friend people from viewing a specific field. For example, there could be a field containing the user's phone number. I would want other users not to be able to see this field unless they are the user's friend.

How do you do this? Are there any modules or anything else that could help me?


texts:
I would like to have a page with some html content in it that CK Editor does not seem to support, in particular: I want to have a little <form tag with a couple of <input fields. I can enter it in Switch to plain text editor mode and save from there and it will keep the elements but when I want to edit the page, it'll go back to the Switch to rich text editor and remove my <form html items. How can i set CD Editor to not remove any html it may not be able to render?
Thank you!


texts: How to add delete button to file field upload widget that actually deletes the file (not just association with content)?

texts:
After uploading a file with the File widget for the File field, the file is on the server and remove only disassociates the file from the field (and the content that the field belongs to).

I would like to add a button to actually delete the file. I've considered a number of options:
- via hook_form_alter - but unsure as to what to insert into the $form or $form_state array for the content edit form, regarding new array elements and at what position
- by providing a theme .tpl file (based on what devel_themer suggests - tried a few possibilities by the themes did not 'fire' (execute)
- making use of the API in https://www.drupal.org/project/extended_file_field to write a hook or otherwise in a custom module

Which of the above would be the standard programmatical approach for extending the file widget to provide direct deletion of the file?

Update
I set my debugger to fire on the function file_managed_file_submit($form, &$form_state) that Geoff mentioned. On clicking the Remove button to the right of the file...

The function file_managed_file_submit($form, &$form_state) is called BUT the status is not zero, so the if fails and the delete does not happen - see debug screen below showing all of this:

This commenter has also seen the problem it seems: how to delete the files uploaded in the file field?

Update 2
I think I know what's going on: We have Workbench Moderation on the site. So, it would make sense to not delete the file but rather the remove just disassociates the file from the Current revision of the content. This makes sense if in previous revisions, they did actually need to refer to the file. So by keeping the file present means those previous revisions "integrity" is intact in that they still refer to the file and the link is not broken. So in summary this is 'as design' I think. Thoughts?

(There is a way to properly delete the file through admin/content/file)


texts: Unable to install lullabot/amp and sensiolabs/security-checker

texts:
i have installed amp and composer manager
today i have been trying to get lullabot/amp installed, i have managed to install composer and drush on my computer but im not sure if they have been installed correctly. The image below shows that they are not installed. This is on my localhost/xampp would that make any difference. Could someone help me get this right as its a big learning curve as i have never used composer or drush since today. Any ideas on how to get this working.


texts: How selectively print the content of region.html.twig

texts:
I'm trying to modify the html of region.html.twig
I've used a hook to override the suggestion:
function my_theme_theme_suggestions_region_alter(array &$suggestions, array $variables) {
  if($variables["elements"]["#region"] === 'content' && \Drupal::routeMatch()->getRouteName() === 'view.search.page_1') {
    $suggestions[] = "region__content__search";
  }
}

The content inside the twig is Markup, so I'm trying to use the elements array where there are the various blocks to render.
However, if I try something like this
{% set classes = [
    'region',
    'region-' ~ region|clean_class,
] %}
{% if content %}

                {{ elements | without('content', 'one_block') }}

                {{ elements.one_block}}
                {{ elements.content }}

{% endif %}

In the first col everything is printed. In other words, the filter without isn't applied.
The second col is fine - only one_block and content are printed.
What's more, if I try to
{{ dd(elements | without('content', 'one_block')) }}

content and one_block aren't listed, so they seems to be filtered.
Any idea why this happens? How can solve this problem? Thank you.


texts: Submit handler is not getting called inside theme function

texts:
I have created a draggable table and add a submit button below it. I am able to view the submit button but submit handler is not working. Below is the code.

function form_content_reorder($form, &$form_state)
{
$form = array();
$form['items'] = array();
$form['items']['#tree'] = TRUE;
$form['#theme'] = 'usercontentranking_reorder_form';
$form['name'] = array(
 '#type' => 'item',
 '#markup' => 'Hello  '.get_genderval($user_data['gender']).$user_data['user_name'],);
$form['submit'] = array(
 '#type' => 'submit',
 '#value' => t('Save Preferences'),
 '#submit' => array('user_content_ranking_save'),);
 return $form;
 }

function usercontentranking_theme($existing, $type, $theme, $path) {
$themes = array(
'usercontentranking_reorder_form' => array(
  'render element' => 'element'
),
);
return $themes;
}

function theme_usercontentranking_reorder_form($vars) {
$element = $vars['element'];
drupal_add_tabledrag('draggable_table', 'order', 'sibling', 'weight-group');
$header = array(
 'label' => t(''),
 'label2' => t(''),
 'weight' => t('Weight'),
 'operations' => t('Operations'),
);
$rows = array();

foreach (element_children($element['items']) as $key) {
$row = array();
$row['data'] = array();
$row['data'][] = drupal_render($element['items'][$key]['title']);
$row['data'][] = drupal_render($element['items'][$key]['user_fields']);
$row['data'][] = drupal_render($element['items'][$key]['weight']);
$row['data'][] = drupal_render($element['items'][$key]['operation']);
$row['class'] = array('draggable');
$rows[] = $row;

$themes = drupal_render($element['name']);

$themes .=theme('table', array(
  'header' => $header,
  'rows' => $rows,
  'attributes' => array('id' => 'draggable_table'),
));

$themes .= drupal_render($element['submit']);

return $themes;
}

function user_content_ranking_save($form, &$form_state)
{
  print "text";
}

The line
 $themes .= drupal_render($element['submit']);
able to show up the button but the function user_content_ranking_save is not getting called.
Please help me in this.


texts:
I have an old site built in Drupal 6 and I need to add a new admin user. I cannot give out user #1 and need a new one.

As far as roles go, I have authenticated and anonymous.

Is it as simply as adding a new role and granting full access or is there something a little easier I can do to accomplish this?


texts: How to add multiple products to cart at the same time with attributes

texts:
I have different view blocks that display multiple products on the same page, each product has their own attributes such as product bundle and custom line item, these serves as an option set / criteria of the main product. The results of the options slider will be the value of the customs line item that is hidden.

What I plan to accomplish is to add all these selected products with the selected attributes on the cart at the same time with just one button.

Example:

Product 1:

Product 2:

These are the methods/modules I have tried:

VBO + Rules : https://www.drupal.org/node/1468392#comment-10270105
Commerce Add to Cart Extras
Commerce Ajax Add to Cart + Jquery : Looping through all selected products then clicking the add to cart button by jquery. It works but not that great because sometimes some of the products are not being added. Maybe because of all the ajax request running at the same time?

The first two methods work for the main product only, no attributes of the customs line item and bundle products. I tried including the add to cart form in the view with the VBO or commerce product: quantity field of commerce add to cart extras but it doesn't work maybe because it's a form within a form.

Does anyone have any suggestion on how to make this work?

Thank you in advance!


texts: Can a person that doesn't have access to a page, view an unpublished article to review?

texts:
Can a person that doesn't have access to the backend of my website view an unpublished page?

I.e I want to set up an article but need someone to review before I can publish it. I can't give this person access to drupal, just want them to review the page and content to approve. Is this possible without them logging in?


texts:
I'm developing a module and in the settings page I've inserted a text field to allow users to insert a key.

I thought to change this into a password field but I want to also create a Show password button or a checkbox. How could I implement this functionality?


texts: How to organize this: traders have fruits and recipes too

texts:
I'm building a site in D7 for a little community garden mall with 30 traders/shops. There is a trader which sells fruits, another one sells cakes, another one sells dairy products, and so on.

And I have a page with lots of recipes. The recipes should link to the traders. So for Spaghetti Aglio e Olio: The spaghetti you buy at the wheet farmer, the garlic at the vegetable farmer and a white wine at the liquor shop.

I have a content type trader. And a content type recipe.

How do I organize the products?
We even think about selling some of the products online one day. So that a site visitor could order a box of vegetables of a trader.

Thanks, Joerg


texts: The default login block is not listed in my theme's blocks, if I switch to Garland, it's there and if I type the direct path to the block I can access it, but I can't seem to save it to my block page... does anyone know how to resolve this issue?


texts:
I have a weird situation with the Webform module.

I'm working on a project bidding website, and for this purpose we have got a webform available as a block. The company who built the website made it so that skills grid on the webform are generated on-the-fly, based on the project's requirements. Here is where the problem starts. I accidentally deleted that node, then re-created it; hence the nid change. I then modified the nid in the database in every possible table I could think of. I also renamed and edited the tpl file to match the new nid. Now, when we apply for a project and leave a required field out, it normally should warn me without leaving the project node; which is the case on my development server. However, this is NOT the case on my production server. As I am 100% sure the solution lies in the database (I confirmed this), I suggest transferring the complete database from dev to prod; however the owner of the project raises an objection. So I transferred webform related tables to no avail; then transferred context tables, again no.

What could this issue?


texts: How do I check the version of a third-party module?

texts:
There's a place in the search_krumo module where we want to supply a different JavaScript file path basing on the version of the Devel module being used.

Is there a Drupal function that will check the version for us, or do we need to get the module version with system_get_info(), and then do something with  $module['version'] (which is a string like 7.x-1.5) ourselves?

If the latter, how should we test if version is greater than 1.6? Should we convert the string to an integer, strip out the x and stuff, and compare integers?


texts: How to return taxonomy term list from all active facet filters on page and use this list as contextual filter in block of usual views

texts:
Please need help. (not solr)

I have views facet page (list of users) with facet filters by fields (taxonomy terms) in this page -> i need to past usual views block (with nodes) in this page with contextual filter as taxonomy terms taken from active facet filters of page.

How to do this?


texts: How do I access a custom field from an action?

texts:
I want to access a custom field names field_heat in a Rules action in D8 and it does not accept it. This is my condition:

And this is my action which cannot be accepted:

If I use a build field like node.title.value it works OK so the problem must be with custom fields. I am using Rules 8.x-3.0-alpha1.


texts: Dealing with errors 403, 404 in Google Webmaster Tools

texts:
I know it may not be strictly drupal releated question, but I'm curious what would be the best approach to solve it with Drupal.

403 errors to: taxonomy/term/%/feed

I have around 900 errors with 403 most of them look like this taxonomy/term/26/all/feed so they seem to be caused by taxonomy/term/%/feed and my question is how could I best fix this issue ?

So that Google would not penalize me with 404's after ? should I somehow change the view.. or ? not sure how to approach this maybe you have experienced similiar issue also when I try to accesss "name_of_term/feed" it doesnt seem to work

404 errors exposed fields with ?field_name=value

I have have around 200 errors of 404 type most of them look like this: NAME_OF_TERM?field_brand_tid=All&field_color_tid=192&field_size_tid=253

From what I understand it is showing options in exposed filters for items that doesn't have any nodes assigned to them.


texts: How to alter an existing breadcrumb link programmatically?

texts:
I am trying to alter the 'Home' Breadcrumb link using
hook_system_breadcrumb_alter()
The default Breadcrumb class allows you to add New links using the
addLinks
method.
However it does not allow one to edit the links. Is there a way to edit an existing link directly?


texts: How do I create a Zen's sub-theme using Drush?

texts:
I am trying to install Zen theme and create a new sub-theme from STARTERKIT. I am using the following Drush commands.

drush dl zen
drush cc all
drush zen "Name" machine_name --description="Description." --without-rtl

The first two commands work; the third one throws an error:

  The drush command 'Name machine_name' could not be found

Does anyone know how to do this?

EDIT

My mistake must be that I'm running Drush from my local machine. I downloaded Drush for Windows from the Drush site. I should be running it on my server where my Drupal site is right?


texts: Custom entity field UI "EntityDisplay entities can only handle fieldable entity types."

texts:
I've created custom entity using drupal console and added my required properties using base field definitions.
Everything was working well in that I could add and view the entities until I changed a setting in the field UI for one of the properties on that entity type.
When I try and view an entity now I get the following error message.
InvalidArgumentException: EntityDisplay entities can only handle fieldable entity types. in Drupal\Core\Entity\EntityDisplayBase->__construct() (line 126 of core/lib/Drupal/Core/Entity/EntityDisplayBase.php).

I thought all the properties on my entity would be manageable in the field UI, I can see them and make changes in the UI but as soon as I do it breaks.


texts:
following this guide to display alternative prices for certain roles: http://jamestombs.co.uk/2012-09-14/drupal-commerce-different-prices-different-customer-groups

But for some reason I don't get any suggestions or dropdown in the Data Selector field.

I've tried changing jquery versions which doesn't correct the error.

Any other ideas? I've added a detailed description of my approach below the screenshot.

It's a d7 commerce site, all modules is the latest versions

Step by step approach to making the pricing rule

created 'retailer' role
added a new field of the type 'price' called field_ppd (ppd = price per dealer)
created a 'retail price' rule at admin/commerce/config/product-pricing/rules/add
added a 'Entity has field' condition
And it's in the condition config I'm stuck since the Data Selector field doesn't auto-suggest when I start typing


texts: Commerce one-off products in admin interface

texts:
Is there a way I can create the capability for an admin to add a one-off product when creating an order through the admin interface? (For example, it could have a SKU of "CUSTOM" but we'd need the ability to enter a custom description that would show up in the line item in the receipt).

These are for customizations that are not available to the general public/only available if an admin enters them and would only be useful one time, so creating a full-fledged product for each one is not feasible.

I have done some testing with Commerce Customizable Products but it seems to allow customizable fields on the front end, but not in the admin "Add Order" screen where I need it.


texts:
It seems nevertheless rather simple, but I do not find the solution.

How to print in node.tpl.php the url of the login page?

The url has to serve for a link:

<a href="<?php print ... ?>">Login


texts: How to send email attachment without using Mime Mail module?

texts:
I am trying to send an email attachment without using the Mime Mail module or installing any other module.

At the moment the email is being sent and I can receive it but it doesn't have the attachment, it even shows the little paper clip that represent the attachment, but when I click it I get an empty html file by the name attachment.html.

Does anyone have an idea on how to do this without installing any other modules?

P.S I am using the HTMLMAILSYSTEM for sending emails.

     * Implements hook_mail()
     */
    function mymodule_mail($key, &$message, $params) {
      switch ($key) {
        case 'send_report':
          $message['headers'] = array(
            'MIME-Version' => '1.0',
            'Content-Type' => 'text/csv; charset=UTF-8; format=flowed; delsp=yes',
            'Content-Transfer-Encoding' => '8Bit',
            'X-Mailer' => 'Drupal',
            'Content-Disposition' => 'attachment',
          );
          $message['subject']= $params['subject'];
          $message['body'][] = $params['body'];

          if (isset($params['attachment'])) {
            $message['params']['attachments'][] = $params['attachment'];
          }
          break;
      }
    }

    /**
     * Calls the drupal_mail method which sends the csv
     */
    function send_email() {

      $key = 'send_report';
      $module = 'mymodule';
      $to = "email@mydomain.com";
      $from = variable_get('site_mail');
      $body = "Attached in this email is the report";
      $attachment = array(
        'filecontent' => file_get_contents('/tmp/report.csv'),
        'filename' => 'report.csv',
        'filemime' => 'text/csv',
        'list' => TRUE
      );
      $send = TRUE;
      $params = array(
        'subject' => 'Missing SKU Images Report',
        'body' => $body,
        'attachment'=>$attachment,
      );
      $language = language_default();
      $result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
      if ($result['result'] == TRUE) {
        drupal_set_message(t('Your message has been sent.'));
      }
      else {
        drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
      }
    }

Note: I read the question about "Send attachments with drupal_mail". Most of the answers mentioned are using the MIMEMAIL module which I can't do (because I am not allowed to install any modules).


texts: How To Remove Menu Tabs From Custom User Dashboard

texts:
I'm working on creating some custom user dashboards but cannot seem to find how to remove certain menu items. I intend to use a combination primarily of Panels with Context and Views (but I haven't ruled out simply using Homebox) but at this early stage learning D7 I've created a custom Variant in the system Panels template, created a rule set in the Variant which will set each user dashboard to load based on their subscription (Ubercart Role). Because of the nature of the Roles, different DBs are required.
As you can see in the attached screenshot, the menu tabs are showing left to right (View, Affiliate Center, Bookmarks etc), I've tried going through all the backend and cannot for the life of me find what controls them to show, could somebody please tell me what causes them to show, so I can either 'hack it' or delete it.

I know it maybe a theme influence and for my current testing I'm using Bartik, but I intend to use an HTML5 theme based on either AT Theme or Boilerplate, but haven't got to that stage as yet (or that maybe my next 'hack' learning lesson today!). Ultimately, I intend to use a Less framework, but for now I merely want to get the functionality working BEFORE I do CSS.

So, what's influencing the menus in my basic User DB as shown here?

https://dl.dropbox.com/u/55172207/screen_shot_cp.png

Thanks in advance to anyone for the help.


texts:
I have a taxonomy tree like this:

balls

basketball

color

red
green

volleyball

color

red
green

If a Taxonomy term has children, I want to show them; if there aren't children I want to show the nodes associated with the taxonomy term.

My view settings are the following.

This is similar to Show all child nodes of a taxonomy term D7, but I cant get it to work.

I use Content: Has taxonomy terms (with depth), and I set the depth to 1. It doesn't work as expected.


texts:
Pages are not shwoing up. They display the follwoing error:

InvalidArgumentException: Cannot redirect to an empty URL. in Symfony\Component\HttpFoundation\RedirectResponse->setTargetUrl() (line 86 of /home/../public_html/domain.com/vendor/symfony/http-foundation/RedirectResponse.php).

On page:
The website encountered an unexpected error. Please try again later.InvalidArgumentException: Cannot redirect to an empty URL. in Symfony\Component\HttpFoundation\RedirectResponse->setTargetUrl() (line 86 of vendor/symfony/http-foundation/RedirectResponse.php).

I also noticed that the LOGO and HOME in the main menu do not redirect to the front page but instead they redirect to the current page, which is not correct.

Any help or insight will be greatly appreciated.


texts:
I added a validation hook to a node creation form.

For my project, i need this validation only ONE time: basically i just check if a value already exists in the DB and i notify it to the user. If the user still submits the form, i must add it anyway.

i would like to do something like that:

if (form_did_not_fail_validation_before) {
  $form['#validate'][] = 'my_module_validation_hook';
}

in my hook_form_alter, so that validation hook is only called the first time.

I can't find a way to check if the form already failed validation, any ideas?


texts: What are the problems with merging DB dumps?

texts:
A strategy I've used with ExpressionEngine for managing the CMS in different environments is to use Git to merge the DBs of my dev and live environments when I need to deploy something new to live. This is working really well for me, my users are creating content but I can code without fear at the same time.

I see comments here and here that make it seem like the same is not true for Drupal 6. Is this just a question of the size of the database (which I think I could cater for by ignoring certain tables), or are there other concerns?


texts: Node "add" with already set paragraph fields

texts:
Each of my article nodes has a set of 7 paragraphs elements that must be filled in. Is there some way the client does not have to add them manually each time?

Would I create a hook that adds some kind of auto (default) paragraph entity to the paragraph field when the node is created?

Is this technically possible?

I think I have seen once a module that allows to define default paragraphs via the url.

But I think I am wrong.


texts: How to relate a Drupal user using a custom Content Type with a common field using Views module?

texts:
I am trying to use the Views module, either via the UI, or using a hook offered by the Views module, to select a Drupal user using a value from a custom Content Type named record that I defined. Let me explain further:

The Drupal user has a field named 'field_usr_banner_id' that holds a value that matches the same value that would be available in the Content Type named 'field_cvsoptout_studentid'. So essentially I would like this to happen, explained via pseudo-code.

Drupal user has a banner Id of '222222'
Record has a student Id of '222222'

SELECT * FROM User INNER JOIN Record's Student Id ON Drupal User's BannerId

See, when adding a new content type of 'record', I specify a few fields, and one of those fields is the student id. I would like to configure views so that it knows it can reference a Drupal user with the student id, and if a Drupal user does exist, to return the first, lastname, and banner id. If a Drupal user does not exist, to just display the banner id.

I'm going through this trouble because it's possible that when a record is created, the Drupal user does not exist. Now, I could specify the user information when the record exists, but if a Drupal user is ever created in the future with a banner Id matching the record's student Id, the record would not display correctly.

Is this even possible to do in Drupal with the Views module? Is there an easier way of doing this?


texts:
I'm trying to modify the output of the language switcher block to make the output more inline with other menu styles on my site. However, I can't figure out how to modify the output.

I'm attempting to use the following:

function my_module_preprocess_block(&$variables) {
  var_dump($variables['elements']['#id'];
}

This gets every block on the page except for the language switcher.

How can I preprocess or modify this?


texts: Query nodes with a specific word in them

texts:
I'm very new to Drupal and I need to grab all nodes that have a certain word in them, for example I want to grab all nodes with the Word 'Hello' inside the body field. I need to use the EntityFieldQuery class too. I'm assuming I need to use the fieldCondition method but not sure how to set that up as there's not a lot of documentation...

Thanks
Alex


texts: How to override a function inside of a Trait?

texts:
My goal is to override the function isApprovalRequired() in a Trait for the module Social Auth (social_auth). The file:

modules/contrib/social_auth/src/SettingsTrait.php

has a function (along with variables and other functions):

namespace Drupal\social_auth;

use Drupal\Core\Url;
use Drupal\user\UserInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
* Helper methods for Social Auth and Drupal settings.
*/
trait SettingsTrait {
  ...
  protected $configFactory;
  ...
  protected function isApprovalRequired() {

that I would like to overwrite. How do I overwrite JUST that one function in my own module? I've done similar things with classes before, but not sure what to do with a Trait.


texts: The correct way to include jquery in a module's form

texts:
I'm trying to use jquery in a form of mine that is rendered via the form api.

How i'm getting jquery to work now is like so

$form['raf_raffle_name'] = array(
    '#type' => "textfield",
    "#prefix" => "
Raffle information

",
    "#title" => "Raffle Name:",
    "#required" => TRUE,
    "#attached" => array(
        'js' => array(
            "$path/jquery.js", "$path/test1.js"
        ),
    )
);

well it works, but i'm not sure if its the right way. Is there a better way? I'm inclined to ask after i saw the 'library' attribute which is supposed to load up certain javascript plugins.


texts: Unique field value per multivalued field collection

texts:
Field collection Config (multi value)

Field1---Name -Autocomplete (single value) (Entity Reference)
Field2---Score - Computed field.

Example Values for field collections

Field collection [0]
------Bill (1112)- where 1112 is nid
------Score - some value will be generated depends on 1112

Field collection [1]
------Roger (1345)- where 1345 is nid
------Score - some value will be generated depends on 1345

Field collection [2]
------Roger (1467)- where 1467 is nid
------Score - some value will be generated depends on 1467
..
..
Field collection [n]
------Maddy (1652)- where 1652 is nid
------Score - some value will be generated depends on 1652

From above config how to make field Name's value should not hold the duplicate value for field collection ie Bill should not be applied again.
There is a module called https://drupal.org/project/unique_field which forces field's value to be unique per content type or per all node, but not per field.
In above case somehow(that what is required) if we make per field then also it could only applied to Name field which is inside field collection rather than field collection itself. Right?


texts: How to check if an entity is referenced before deleting?

texts:
Is there a module or a way to use Rules to make sure that a parent node isn't referenced by a child node before deleting the parent?

In my case the children require a parent to be created. However if the parent gets deleted, the children all get screwed up.


texts:
I am using tcpdf to generate a PDF. The PDF generation adds images that have been uploaded. The order of the images matters. After I upload files in Drupal 6 using the upload module, Drupal 6 randomly orders the images (or attachments).

The uploaded images are draggable. But when I drag them to re-order and hit save, the order goes back to what Drupal thinks is best.

How can I change this behaviour to let Drupal recognise my re-ordering?

Thanks


texts: Display Views Result Summary in Twig Template

texts: I have views with exposed filter and display exposed filter as a block. I need something like views result summary on my twig template. How am I supposed to achieve this in Drupal way.


texts: Invalidate Internal Page Cache on cookie change

texts:
I need to invalidate the Internal Page Cache for anonymous users when the value of a specific cookie changes. How can I implement this?

I'm tried to add:

$build['#cache']['contexts'][] = 'cookies:my-cookie-name'

in hook_entity_build_defaults_alter, but that doesn't help.
And the page still returns from the cache.


texts: How do I save username and password using a "Remember me" checkbox in the login form?

texts: I want to save username and password using a Remember me checkbox. If I click it, the username and password should be save for future. In Drupal I am using Persistent login module to do this but I am not able to save the username and password.


texts: View to get information for the user entity reference using contextual filters

texts:
I have two content types and each one has a user entity reference field.   I want a view using contextual filter that shows the information of the content types when I pass the user ID referenced for the user entity reference field.
content-type 1:  field -> studies, field -> id-user-entity-reference
content-type 2:  field -> experience, field -> id-user-entity-reference
I want to get for example studies and experience in a view when I have a path similar like that:
/content/id-user-entity-reference (not the logged user, not the author id of the content type)
I need these results can be exposed via rest.
How can I configure my view to achieve that?


texts: Theme suggestion template is not being picked up

texts:
I add template suggestion in my discount module:
function discount_theme_suggestions_field_multiple_value_form_alter(array &$suggestions, array $variables) {
    if ($variables['element']['#field_name'] == 'user_discount'){
      $suggestions[] = 'field_user_discount';
      kint($suggestions);
    }
}

And I can see template suggestion on my admin form:

However I added template field-user-discount.html.twig (I don't place it here as it simply the copy of classy one with change of order) in discount module templates folder and it is not being picked up, it still picks up the classy one. I cleared all the caches, both from drush and site itself. I also tried to add this template to theme templates, it is not being picked up there as well. Other templates from both theme and discount modules are being picked up.
How can Drupal pick it up? It is the field on admin pages.


texts: Upgrading Drupal from 6 to 7 results in double slash being present in image file paths

texts:
After upgrading from Drupal 6 to Drupal 7 I noticed that my image paths now have a double slash like this:

/files/sites/default//filename.jpg

I was thinking of running a simple find and replace in the database, but I'm sure how to resolve this.


texts: Impossible to html_entity_decode the button title in a render array

texts:
Here is the code that reside in my extended class of the RegisterForm:

$title=$this->t("M'inscrire") // notice the apostrophe in French
// the $element variable is the action sub array of the form
$element['submit']['#value'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
dpm(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));

Unfortunately, my submit button is displayed like M&#039inscrire
And strangely, the dpm function print it as it should be

Edit to add, the following does not work:

$element['submit']['#value'] = $this->t("M'inscrire"); //NOT WORKING
$element['submit']['#value'] = "M'inscrire"; //NOT WORKING


texts: How to set a term reference field value from a text field with Rules?

texts:
In the user entity, there are 2 fields: a single-valued field_department_text A (a text field) and a multi-valued term reference field_department B.
Now, I need to use Rules to append A's value to B when a user was created. I tried, but failed.


texts: How can I display content from tab that was active on save?

texts:
I'm using Drupal 8, including paragraphs.

I have a content type with a paragraph field, and this paragraph contains a fieldgroup of two fields that display in horizontal tabs.

When adding content, on save only the content in the active tab should be set to display on the page. In other words, you choose one tab or the other, add content into its designated field and save. The content in that active tab is the content that will display when viewing the page (even if there is content in the other tab).

How can I display the content from only the tab that was active on save?