texts: Don't allow role to delete published content even its their own

texts:
thanks for reading my question.

I am currently working on Drupal 8 site, please consider the following roles:

Admin - Can do everything
Publisher - can do everything the Admin can do, except set up and edit new
administrators
Editor - Can do everything the publisher can do, except Publish content to live
Writer - Can do everything the Editor can do, except Delete published content

I have managed to satisfy the permission for the roles Admin, Publisher, and Editor, now it seems the Writer one is tricky.

The only option seems like to Enable Delete own content for Writer, but that won't solve the issue if his article was already published, he can delete it.

Is there a module that can be solved by this? Or a better approach on how to configure permissions?

Regards,


texts: How do I allow editors to select a template with CkEditor?

texts: I am using CkEeditor to edit the node body field. I want to add a Select template option in CkEditor.


texts: Programmatically detect panelizer columns layout

texts: Can you give me some directions how to properly detect the panelizer current layout. My idea is when one pane is added to the page to programmatically detect is it 1, 2 or 3 columns wide and based on this information to switch between different cases and to show content with different settings. I tried to locate this information using devel module  but nothing useful came up.


texts: How can I change slick views animation speed?

texts: I tracked down the variable in slick that changes the animation speed called speed, but I can't seem to change it. In other words, when I change it, it doesn't seem to do anything. I have tried changing it via the browser dev tools, and I tried editing the speed in the slick module. I see that there is Form code to change the speed, but I am not sure where the form is in the UI. Right now the speed to change slides is 3000 and the animation speed is 300. I want to slow down the animation speed.


texts: How do I allow full HTML while rendering a view?

texts:
Some HTML code like <iframe> is stripped out. How can I allow full HTML in a view?

    $options = array(
        'id' => 'area_text_custom',
        'table' => 'views',
        'field' => 'area_text_custom',
        'relationship' => 'none',
        'group_type' => 'none',
        'admin_label' => '',
        'empty' => TRUE,
        'tokenize' => FALSE,
        'content' => "My HTML Code with <iframe ... >",
        'plugin_id' => 'text_custom',

    );
    $view->setHandler('page_1', 'footer', 'area_text_custom', $options);


texts: Why form redirects to encoded url when having GET params?

texts:
I have a simple form with 1 select and I want it after the form submit to redirect to the same URL, but with added GET params.

So in a form submit I added:

$form_state['redirect'] = url(arg(0).'/'.arg(1).'/'.arg(2), array(
  'query' => array(
      'brand' => $state['values']['brand'],
      'categ' => arg(2)
)));

Which redirects to wrong encoded url:

  /produkty/vlasy%3Fbrand%3D118%26categ%3D27

But It works well when I use drupal goto (this is not recommended):

  drupal_goto(arg(0).'/'.arg(1).'/'.arg(2), array(
      'query' => array(
          'brand' => $state['values']['brand'],
          'categ' => arg(2)
  )));

  /produkty/vlasy?brand=118&categ=27

Why is it so?


texts:
I'm trying to create a custom module for Drupal 7 that makes two widgets available for Text fields. The widgets are showing up in the list of available widgets, but when I select one of them as the widget for a Text field, the field isn't visible on the form (although it is still listed in the Manage Fields section and its settings can be changed as normal). Here's my code so far:

<?php
/**
 * Implements hook_menu().
 */
function autocomplete_jsb_users_menu() {
    $items['jsbu/speaker/autocomplete'] = array(
        'page callback' => 'jsbu_speaker_autocomplete',
        'access callback' => TRUE,
        'weight' => 1,
    );
    $items['jsbu/venue/autocomplete'] = array(
        'page callback' => 'jsbu_venue_autocomplete',
        'access callback' => TRUE,
        'weight' => 2,
    );
    return $items;
}

/**
 * Implements hook_field_widget_info().
 *
 * Two widgets are provided.
 * - A textfield Speaker name autocomplete widget.
 * - A textfield Venue name autocomplete widget.
 */
function autocomplete_jsb_users_field_widget_info() {
    return array(
        'autocomplete_speaker_name' => array(
            'label' => t('Autocomplete Speaker Name'),
            'field types' => array('text'),
        ),
        'autocomplete_venue_name' => array(
            'label' => t('Autocomplete Venue Name'),
            'field types' => array('text'),
        ),
    );
}

/**
 * Implements hook_field_widget_form().
 */
function autocomplete_jsb_users_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
    //load the default text instance
    $element += text_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);

    /*if ($instance['widget']['type'] == 'autocomplete_speaker_name') {
        $element['value']['#autocomplete_path' ] = 'jsbu/speaker/autocomplete';
    } else if($instance['widget']['type'] == 'autocomplete_venue_name') {
        $element['value']['#autocomplete_path' ] = 'jsbu/venue/autocomplete';
    }*/
    return $element;
}

/**
 * Implements the autocomplete_jsbu_speaker() callback.
 */
function jsbu_speaker_autocomplete() {
    $matches = array();

    // Query the database
    $query = db_select('field_data_field_speaker_name', 'sn');

    // Select rows that match the string
    $query
        ->fields('sn', array('field_speaker_name_value'))
        ->orderBy('field_speaker_name_value', 'DESC');

    $result = $query.execute();

    // add matches to $matches
    foreach ($result as $row) {
        $matches[$row->field_speaker_name_value] = check_plain($row->field_speaker_name_value);
    }

    // return for JS
    drupal_json_output($matches);
}

/**
 * Implements the autocomplete_jsbu_venue() callback.
 */
function jsbu_venue_autocomplete() {
    $matches = array();

    // Query the database
    $query = db_select('field_data_field_venue_name', 'vn');

    // Select rows that match the string
    $query
        ->fields('vn', array('field_venue_name_value'))
        ->orderBy('field_venue_name_value', 'DESC');

    $result = $query.execute();

    // add matches to $matches
    foreach ($result as $row) {
        $matches[$row->field_venue_name_value] = check_plain($row->field_venue_name_value);
    }

    // return for JS
    drupal_json_output($matches);
}

Any ideas on what I'm doing wrong there/anything else I might need to add? Is the problem that I'm missing a hook?

EDIT: $element just before return:

Array (
    [#entity_type] => node
    [#bundle] => event
    [#field_name] => field_event_speaker
    [#language] => und
    [#field_parents] => Array
        (
        )

    [#columns] => Array
        (
            [0] => value
            [1] => format
        )

    [#title] => Speaker
    [#description] =>
    [#required] =>
    [#delta] => 0
    [value] => Array
        (
            [#autocomplete_path] => jsbu/speaker/autocomplete
        )

)


texts: I've a question regarding the installation of modules via the web browser. At the moment, I can easily upload both themes and modules to my Drupal site via sftp, but when I attempt to do the same using the module 'Update Manager' (i.e., through the web server itself, to avoid the hassle of adding the theme/module manually) I get an error that reads "Your server does not support installing modules and themes from this interface..." How does one enable the fix? I've read through some documentation regarding module installation but the comments seem contradictory, with some users suggesting a chown prompt and others saying such a solution is a breach of site security and thus to be avoided. Is there any consensus on what to do in this situation? Any help would be appreciated.


texts: Why does it take so much to load 100,000 rows of data with Feeds Module

texts:
I am importing 8,000 products which have associated several items from thousands of taxonomies (nested taxonomies, 3 levels) and fields collections. I have 7 feeds which are sequenced with Elysia Cron.

I import the following, with these number of items:

Families, level 1: 12 (taxonomy)
Families, level 2: 70 (taxonomy)
Brands of cars, level 1: 35 (taxonomy)
Series of cars, level 2: 300 (taxonomy)
Models of cars, level 3: 3000 (taxonomy)
Products: 8,000 (nodes).
Multiple references for products: 15,000 (collection fields). It includes association of several models (point 5).

The total amount of times for the update is of 30 minutes. Isn't it too much?
There are tables in the collection_fields of around 100,000 rows.

I am worried when I will have to scale the site to have 100,000 or more products. I should I explore using fewer nested taxonomies, and use an approach with only a few taxonomies, and most of the other data, like models of car, etc., being nodes and using Relations module?


texts:
I am trying to retrieve some fields from my Profile 2 profile but am not sure how I should connect the table dr_field_data_field_resources to its relevant user.

In profile it is possible to add a field term_reference 'resources', then I want to be able to retrieve those values in an array based on a user I specify. I did see some other docs for profile2_load, but I using an example turorial. I am getting called to undefined function for profile2_load().

$userskillsresources = db_query("SELECT dr_users.name as 'username', dr_taxonomy_term_data.name  as 'userresourceterm'
    FROM dr_users
    JOIN dr_field_data_field_resources
    JOIN dr_profile ON dr_users.uid = dr_profile.uid
    JOIN dr_taxonomy_term_data ON dr_field_data_field_resources.field_resources_tid = dr_taxonomy_term_data.tid
    WHERE dr_users.uid = '10'")->fetchAssoc();


texts: hook_form_alter() on a view exposed filter form

texts:
I am trying to add a disable attribute in a field using the hook_form_id_alter function.  I created a module and built the function

function disableIncentiveform_form_views_exposed_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form['#id'] == 'views-exposed-form-drive-clean-incentive-search-page-1'){
    $form['field_new_used']['#attributes']['disabled'] = 'disabled';
  }
}

However, this does not add an attribute to the form.

I know there used to be a hook_form_views_exposed_form_alter function in D7 but I can't find anything specific for D8.  Is there a correct way to do this?


texts: How to setup a Facebook page block for each user?

texts:
Is it possible to setup Facebook block for each user? When a user registers or later in specific node he can copy/paste a link in text field that will result in his Facebook page block.

I know how to setup views contextual to show block for each user based on user's id or nid, so that part is covered.


texts:
I am trying to execute the following in page.tpl.php.

setcookie('front_page_survey','yes', time() + (86400 * 365), "/");
echo $_COOKIE['front_page_survey'] .'cookie' ;

setcookie() works as intended, but when I try to read it, nothing get printed.

What am I doing wrong?


texts: print data to twig file from custom form submit via controller

texts:
I have created a custom form, and I'm passing data to twig file from submitForm function as follows

public function submitForm(array &$form, FormStateInterface $form_state)
{
$form_state->setRebuild();

$data = ['role' => $form_state->getValue('role'),
'date' => $form_state->getValue('date')
];
MyController::Detail($data);

}

and in controller passing data to twig

public static function Detail($data) {

return [
'#theme' => 'my_report',
'#data' => $data,
];

}

but not able to get/print data in twig file.


texts: Passive / light-weight / serializable translatables?

texts:
So.. in Drupal 8 we have several classes that implement \Drupal\Core\TypedData\TranslatableInterface, and we have Drupal\Core\StringTranslation\TranslatableMarkup.

Each of these classes contain references to services that will actually do the translation, making them heavy on e.g. var_export() or serialize().

Is there a class to store an untranslated string plus replacements plus options, that does not contain these dependencies?

Maybe \Drupal\Core\Annotation\Translation does get close, but I think it  is only meant for annotations.


texts: Is theme_pager() vulnerable to HTTP Parameter Pollution?

texts:
I'm currently running vulnerability scans against my application, which is based on Drupal. One "High" vulnerability is HTTP Parameter Pollution (HPP), and it has to do with pages that make use of drupal's theme_pager().

I know that it could indeed be (and probably is) a false-positive, but I need to be able to understand why it isn't a vulnerability so that I can remediate the scanning report. I'm hoping that someone with more security experience than I can help.

The found vulnerability is as follows (I'll use drupal.org in this example):

Visit a url that has a pager on it:

https://drupal.org/search/site/cat

Append a useless query parameter+value to the url such as %26foo%3dbar (or &foo=bar , I'm not sure if it actually matters)

https://drupal.org/search/site/cat%26foo%3dbar

The "vulnerability", as I understand it, is that the pager link URLs (1,2,3,4,etc) all contain the &foo=bar param.

The actual scan output was as follows:

  Vulnerability description This script is possibly vulnerable to HTTP Parameter Pollution > attacks.

  HPP attacks consist of injecting encoded query string delimiters into other existing parameters. If the web application does not properly sanitize the user input, a malicious user can compromise the logic of the application to perform either clientside or server-side attacks.

  This vulnerability affects /.
  Discovered by: Scripting (HTTP_Parameter_Pollution.script).

  Attack details

  Path Fragment input / was set to qui&n950086=v982658
  Parameter precedence: last occurrence
  Affected link: /search/node/qui?page=1&n950086=v982658
  Affected parameter: page=1

  Request GET /search/node/qui%26n950086%3dv982658

So my question is two-fold: Should this be considered a false-positive? How is Drupal protecting itself from HPP?

Thanks!


texts:
I've got the following code in my module. I'm trying to get it to insert some HTML, ideally at the start of <body>, but it seems that my call in hook_init() isn't working - what would be the right hook to call this in? I'm hoping it will just render slidedown.tpl.php after <body>.

<?php
function slidedown_init() {
    drupal_add_js(drupal_get_path('module', 'slidedown') . '/slidedown.js');
    drupal_add_css(drupal_get_path('module', 'slidedown') . '/slidedown.css');
    slidedown_insert_html();
}

function slidedown_insert_html() {
    return theme('slidedown_template');
}

function slidedown_theme() {
    $themes = array (
        'slidedown_template' => array(
            'template' => 'slidedown', // your template file called slidedown.tpl.php
            'arguments' => array(),
        ),
    );
    return $themes;
}
?>


texts: Drupal 7 - Show Child Taxonomies and content in current taxonomy

texts:
I have a site that has multiple levels of "Category" taxonomies with varying content within each level.

I have tried for a couple of days but basically i wish to accomplish the following: When a user clicks on a Category view e.g.. /taxonomy/term/% they are presented with a list of child categories and also a list of content items (if any exist) within the parent category.

I have managed to create a view that will show the list of child categories however i cannot combine this with the default term view.

I have attached a mockup of what i wish to accomplish. Any help is greatly appreciated.

Thanks so much for your help.


texts: How can you add a multiple value field to an entity?

texts:
Edit: My question is similar to How to create multi-value, multi-bundle entity reference fields in code?, except the field doesn't need to reference multiple bundles.

We have an existing view of custom entities.  The view needs to now be filtered based on some related fields that are not part of the entity (or any entity).  Kind of like adding a Taxonomy Reference field to a Content Type.  What is the best way to add those fields to the entity?

I see that many modules use attachLoad to attach fields to an entity, but when I try my implementation those fields don't show up in my list of Fields or Filters in Views.

This is a screenshot of the checkboxes field:

This is my controller:

class ContactsController extends EntityAPIController {

  public function attachLoad(&$queried_entities, $revision_id = FALSE)
  {
    foreach ($queried_entities as $key => $entity)
    {
      $queried_entities[$key]->foo = "bar";
    }
    parent::attachLoad($queried_entities, $revision_id);
  }

}

And this is my hook_entity_info:

function contacts_entity_info() {
  $return = array(
    'contacts' => array(
      'label' => t('Contact'),
      'entity class' => 'Contacts',
      'controller class' => 'ContactsController',
      'views controller class' => 'ContactsViewsController',
      'base table' => 'contacts',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'ckid',
        'bundle' => array(),
      ),
      'bundle keys' => array(),
      'bundles' => array(),
      'load hook' => 'contacts_load',
      'view modes' => array(
        'full' => array(
          'label' => t('Default'),
          'custom settings' => FALSE,
        ),
      ),
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      'module' => 'contacts',
      'access callback' => 'contacts_access',
    ),
  );

  return $return;
}

This is a suggested implementation of EntityDefaultViewsController:

/**
* EntityTest Views Controller class.
*/
class ContactsViewsController extends EntityDefaultViewsController {

  /**
   * Add extra fields to views_data().
   */
  public function views_data() {
    $data = parent::views_data();

    // Add your custom data here
    $data['contacts_topics']['table'] = array(
      'group' => t('Contacts Topics'),
      'base' => array(
        'field' => 'ckid',
        'title' => t('Contacts Topics'),
      ),
      'join' => array(
        'contacts' => array(
          'left_field' => 'ckid',
          'field' => 'ckid',
        ),
      ),
    );

    $data['contacts_topics'] = array(
      'ckid' => array(
        'title' => 'Contact Entity ID',
        'field' => array(
          'handler' => 'views_handler_field_numeric',
          'click sortable' => TRUE,
        ),
        'sort' => array(
          'handler' => 'views_handler_sort',
        ),
        'filter' => array(
          'handler' => 'views_handler_filter_numeric',
        ),
        'relationship' => array(
          'base' => 'contacts',
          'base field' => 'ckid',
          'handler' => 'views_handler_relationship',
          'label' => t('Contact entity relationship'),
          'title' => t('Conact entity relationship'),
        ),
      ),
    );

    return $data;
  }
}

Unfortunately I don't see anything in the Views SQL that shows that any of these attempts to add the fields or join the topics table to the contacts table are working.


texts: Gettting errors after install drupal-8.2.6.nl.po

texts:
I add Language Dutch and import drupal-8.2.6.nl.po

This error is showed on every page: sourcetext 'The file could not be created'

What should I do?
1. Uninstall dutch language?
2. reinstall dutch language?
3. change language settings?


texts: What does xmlrpc.php do and how can I use it?

texts:
I have seen xmlrpc.php but I haven't found much documentation out there. Is it possible to use this directly without any additional modules? Where is the canonical documentation for it?

Is xmlrpc.php what is refered to here as "drupal's xmlrpc"? If that statement is correct xmlrpc.php would be only for the blog module in core.


texts:
I'm attempting to dynamically generate a node edit link. I understand that I can manually create it by using

$editpath = '/node/'.$nid.'/edit';

but I have multiple sites that use subfolders like

  /site1_subfolder/node/123/edit

and

  /site2_subfolder/node/123/edit

I looked at the node class and I couldn't see any method that would generate this link for me. I did see that there's a NodeForm class but I didn't see any static methods I could take advantage of either.

Given a node or node id is there a way to generate an admin edit link to its edit form?

NOTE: If that's not possible I would be fine with using a function to get the subfolder names so I could do $editpath = '/'.$subfolder_name.'/node/'.$nid.'/edit';

But I'm not sure how to do that either.

UPDATE: I suppose I could do a $node->toUrl()->toString() to get the direct path and add edit at the end but this would only give me the alias, is there a way to not get the alias from this and get the direct link to the node instead?


texts: How to register Post Submit handler for form?

texts:
I have a form which I want to modify some of it's data after submission.

I'm using drupal 8.3 and I tried to used hook_form_alter and registered my functions to $form['#submit'][] and $form['actions']['submit']['#submit'][]  but none of them working after form submission.

Any help? Thanks.


texts: Use Webform to email users with query parameter or argument?

texts:
I want to be able to have a contact form that lets visitors send email to different users (like a staff directory) without exposing the email address or user id. I am going to come up with my own way of identifying users to not expose Drupal specific information. Anyway.

However, I need to:

Pass that value in the URL to identify the user to locate, to know where to send the mail
Load and check the user from that passed value before showing the form
If the user is not a certain role, serve a 404 instead of a form (only certain roles can be contacted).
Preferably have a url like /staff/{FOO}/contact where {FOO} is my custom value.

Would it be easier to just implement this myself, or rely on Webform? I wanted to take advantage of Webform in case the client wanted to add another field later or create other forms (more basic ones), throttle repeat submissions and the dozens of other things Webform can do.


texts: Commerce Coupon block entry to the review page during order process

texts:
I just install Commerce Coupon Module 7.x-2.0-rc2 and required dependencies (discount module, inline conditions).
After that I create discount and applied a coupon to it, I also add right permissions to all users (like "Redeem any coupon").
During simulate buying process I see proper field in the form where coupon need to be put, I add coupon with success.
But when want to go the review part of order I can't because I get error "Please enter a code." (but I've already add code and is that code is added). Also
when I don't want to use a coupon code I get the same error. I can't set this form field as "not required". When I go to the
Store -> Configuration -> Order settings ->Manage Fields and want to edit Coupon Field I see text "The field Coupons is locked and cannot be edited."
(I can edit other fields and there is checkbox option "required" ). I'm newbie in drupal and friend of my ask me to add this feature to his existed site (maybe some other modules block or screw coupon module). Drupal version is 7.31

Thanks in advance for help


texts:
I'm trying to add dependencies to a set of fields, such that only one of the set can ever contain a value at any given time.

I see that drupal_process_states() does pretty much what I want, but I'd have to define it separately for each element. It looks like I'd be using it with hook_field_widget_WIDGET_TYPE_form_alter(), since that takes $elements as an argument?

Is there anything that might simplify this? Specifically, is there a function that can apply rules per fieldset rather than per widget?


texts: create contact form block with prepopulated entity references and send email to content author

texts:
I am trying to create 3 forms, 2 of them should be made into blocks to show on specific content types. One for anon users and another for logged in users. The other is just a site wide contact form replacement for core Contact.

Anonymous Contact Form: Name, Email, Entity Reference to Content, Message

Logged In Contact Form: Entity Reference to Content, Message (Pull username and email from account)

Site Wide Contact: Name, Email, Message, Term Reference to Category

The Entity reference is important since I will be pulling data from it to populate the email message (like nid, author, etc...)

When a user submits the non-site wide contact forms, Rules should be able to pull the data from the form and send an email to the node author.

Views Contact Form/Core Contact: Can't add entity reference fields (or any fields) to it to link form submissions to content.

EntityForms: Creating forms is easy, but the notification part is convoluted at best with complex but somehow simple data selectors (raw output?) for Rules. Also, the token support is spotty at best (or so I have come across). The prepopulate part worked perfectly, but can't seem to figure out if it is possible to send email based on an Email field or get entity reference tokens like [entityform:field_reference:author:mail]. Doesn't seem to work in Eforms.

Webform: Can't get fields to prepopulate and hide/disable.

Custom: Thinking about just doing this. But I am unsure as to how I can add a entity reference field to a custom (non UI) created form and hide the form.

Can anyone recommend the best solution or at least which module is capable of what I need?

Thank you.


texts: Is it possible to set: "show block on specific pages" into "is only the listed pages", programmatically?

texts:
Is it possible to set: "show block on specific pages" into "is only the listed pages"?

I suppose that I should add a new item in this block info, but I don't know which one and can't find it in the api hook_block_info();
This block should be only visible in the page overview_courses/course but is visible in every page except overview_course/course

function menuNode_block_info() {
  $blocks['Course'] = array(
    'info' => t('Dit toont alle blocken weer'),
    'region' => 'sidebar_first',
    'weight' => 1,
    'status' => 1,
    'pages' => "overview_courses/course",
    'cache' => 'DRUPAL_NO_CACHE',
  );
  return $blocks;
}

Can someone help me? all help is welcome.

Kind regards


texts:
I have a drupal 7 website that uses Varnish for caching (through drupal's Varnish module).
 I want a cache warming mechanism that would automatically cache the latest version of the pages after the cache expiration time has passed.

How can i do this?


texts: Are there any quality of life add ons for Content Admin page? Easier sorting, searching, etc

texts: I think the words make it vague for a google search since I'm not really finding anything. Looking for enhancements to the Content screen in Admin (that lists all of your content items). You can search for things and sort by a few select fields but looking to expand this and make it more specific to our content types. Thanks!


texts: Views: Aggregations Do Not Group by a Date Field

texts:
So, I am using Drupal 7.19 and Views 3.5. For some reason, I can not group by a date field no matter what!

I created a simple view that displays the number of nodes that have been published per month. As such, I selected the Nid and Post date fields, enable aggregation, count on Nid and group on Post date.

No grouping. There is a record being pulled for every single node in the database, as if the grouping is being completely ignored.

If you run the SQL statement Views generates on the database, you also get a complete result set but that is obviously because the UNIX time stamps themselves are different, if even my a second. That's expected. How can I get Views to group by a formatted value, such as a Month, Year, etc, to avoid this problem?

I tried everything suggested here and elsewhere - I already had the RDF module disabled, emptied cache, added a new date format, strip white space from the date field ,I even disabled the Date module for fear it was conflicting with it.

This is driving me absolutely crazy! Would appreciate any suggestions. Thanks.


texts: Ajaxify quicktabs does not work when views have contextual filters

texts: I have 4 views and i have made them into tabs using quicktabs and it works fine. But when i try to load then through ajax starting from second views nothing loads.I have some contextual filters in all these views. Is this effecting it? If so how do i get over it ?


texts: How to import node view count with Feeds and Statistics module?

texts: After enabling drupal 7.x core Statistics module, on the feeds node processor mapping page, I still cannot find any suitable target to map.


texts: Is there a way to use Translation Overview with Entity Translation?

texts:
When I use the Internationalization module with Translation Overview all works fine, I can see through admin/content/translation-overview-manage the state of the translations of nodes.

But when I use Entity Translation I can't see this information. I've been searching for some info on the net, but I can't find anything about this.

So, is there a way to use Translation Overview in combination with Entity Translation?


texts:
Does anyone know how to implement comet in Drupal?
I saw a rudimentary PHP implementation on Stack Overflow.
Is there any module which does this?


texts: How to display node in view and allow users add comment?

texts:
Is it possible to display a node in a view and allow users to add comments to the node?

I have not been able to find a way to do this.


texts: How to redirect user for specific pages not found

texts:
I have developed a module that creates a certain set of pages. What I would like to do is create a specific redirect for those pages if they are not found while keeping the generic Drupal 7 wide redirect for all other pages. Is this possible and how would I go about doing it?

Thanks.


texts: How to call Ubercart functionality using Drupal 7 rest services?

texts:
I am using Drupal 7 with Services module for our phonegap application.
In that web application we are using Ubercart module for payment gatway method. I am fetching product list from web service but how can I handle payment method from Drupal service?


texts: URLs with trailing slash say site in maintainence mode, others don't, site isn't in maintenance mode

texts:
Something very strange has happened and I'm at a complete loss as to how to go about working out the cause.

I used Backup / Migrate module to restore a backup of my live site's database (let's call it somesite.com) onto my dev site's database (let's call it dev.somesite.com) after copying the files over.

I visited dev.somesite.com/admin/ and was surprised to be told it was in maintenance mode. I did the usual maintenance mode fixes: drush vset maintenance_mode 0, checking that the contents of variable > maintenance_mode in the database was i:0;, but it still showed as maintenance mode.

A little trial and error later, I discovered that dev.somesite.com/admin did work, and it seemed having a trailing slash in the URL would show the maintenance mode page.

What could possibly be causing such a strange behaviour? My first thought was, since it's a URL formatting issue, there might be a mistake in my .htaccess file, but it looks fine and hasn't changed.

Update: a little more testing seems to show that this only happens for URLs the user doesn't have access to. For example, dev.somesite.com/admin/ while logged in gives the expected user access error, dev.somesite.com/about-us/ while not logged in redirects to dev.somesite.com/about-us and then works fine, but dev.somesite.com/admin/ while not logged in gives the maintenance page not the access denied page.

So, it's not as serious a problem as I first thought, but it's still strange and smells like a sign I might have misconfigured something which might in turn have more serious consequences elsewhere - but I don't know what this could be. I've looked at my Global Redirect settings and they look fine.


texts: Menu Block - stopping displaying children after a specific level

texts:
So I am using Menu Block 7.23 and it is working awesome, I have it setup to start at 2nd level to show the children of the active menu, and if no children show active menu with max depth of 1 which has been working great.

I have been asked to make this navigation now, stop displaying the children after the 3rd level and I am not sure how to handle that in Menu Block configurations. I see there is a start level, but not a stop level. Here is an example of my heirarchy:

-Solutions
--Enterprise
---Profile Management
----Online/Offline

So essentially when going to Solutions it would show Enterprise, when going to Enterprise it would show Profile Management, but on Profile Management they do not want Online/Offline to appear, they want Profile Management to remain as the side menu. They want the breadcrumb to show the whole path on Online/Offline so I cannot just disable it from navigation, it needs to be part of the menu structure.

They want to just put reference links to Online/Offline in Profile Management page content, and on Online/Offline it would keep the Profile Management side menu.

Any help would be most appreciated.


texts: How to limit a user to one vote when using Rate module?

texts:
In Drupal 7, I have installed the Rate module for voting. But here, the user can change his vote anytime he wants.

If I want to restrict an user to vote for a particular node only once, what I have to do?


texts: Add bootstrap row class on every n views rows

texts:
I am using Drupal Bootstrap and to get the correct positioning I am using bootstrap rows and columns classes.

How do I render a bootstrap row class on every let's say 3 view rows (bootstrap columns)? The structure must be like this


texts: Splitting up content fields into different regions

texts:
My situation is as follows: I have a content type Seminar, with fields A, B, and C.  I have regions Header, Footer, Content, and Sidebar Left.  There are some fields in Seminar I want displayed in the Content region, but also in the Sidebar Left region.

How do I go about doing this?  Apologies if this has already been answered before.  I am a developer and am not hesitant to dive into hook and preprocessor functions.  I have the Views module installed, but have never used it (this is my first Drupal site, if you can't tell :P).

Cheers.

EDIT: This is for Drupal 7.


texts: How do I show a message about the currently executed operation?

texts:
I have created a batch, and it's working, but I want to control the messaging a little better. I would like to give the user some feedback about the currently executing operation, other than just letting them know that it has completed.

Here is what I am attempting to do, but it is still executing sleep(5) before updating the message.

function batch_callback(&$context) {

  // set up message for batch operation
  if (empty($context['sandbox'])) {

    $context['message']  = t('Pre-execution message...');
    $context['finished'] = FALSE;

    // put something in sandbox (doesn't matter what)
    $context['sandbox']['step'] = 1;

    return;
  }

  sleep(5);

  $context['finished'] = TRUE;
}

So, how do I set a pre-execution batch message?


texts: How can I import non-unicode text file by Feeds module?

texts:
My drupal version is : 7.5x

I want to import an csv or txt file that have non-unicode (iransystem) encoding.

After import this file to Drupal (persian character with iransystem encoding) my characters show correctly in my site. So these texts are imported successfully. But when I want to filter results of those fields by Views (exposed filter), I can not see any result by filtering views fields (search in fields by views exposed filter).

I want to import non-utf8 or unicode persian text files into Drupal and filter those fields by Views exposed filter (search on non-unicode characters).

For example I imported A Persian or arabian word into a field of Drupal. This passage shows correctly to me, but when I search type this passage in exposed A Persian or arabian word text in Drupal page and paste on search field of Drupal Views, I can see results correctly.


texts: How can I inject relevant/filtered ads every 5th result in a view?

texts:
I have a view that displays filtered results of Business Offers and Events as "cards". Now my boss wants to inject relevant custom ads into the results based on the user selected filters (basically, by city/region and business type)...
So, I created another custom content type called "Ads" with fields for multiple images (different sized ads), a click-through url, some tracking details, the type of business the ad is for (like Restaurant, or Venue, etc), and the "market location" (city/region) that the ad would be relevant to display in.
In the twig template file for this view, here are the relevant lines of code that basically inject an Ad placeholder every 5th row:
{% for row in rows %}
  {% if loop.index|trim|last == '5' or loop.index|trim|last == '0' %}

AD

ADVERTISEMENT

    {{- row.content -}}
  {% else %}
    {{- row.content -}}
  {% endif %}
  {#
 #}
{% endfor %}

And here's what that looks like:

My question is...what's the best way to for me to grab as many unique Ads as possible that are filtered by user selected filters (location and/or business type) of the main offers view...and how can I inject these ads like I have in this twig template?
Some approaches I thought of:

Have the view's content filter simply get two content types: The original offers...AND the ads. Problem: I don't know how to control the order of these results such that they will render 5 offers, 1 ad, 5 offers, 1 ad etc...
Possibly create another view just for the Ads and somehow render only one result of this view for every 5th row of the main view Problem: I don't know how to access and render this data via the twig template, or how to pass the filter values of the main view to the view for the ads via the twig template.
Perhaps I could create a attachment view for the ads with filter values inherited from the main view, initially hide all the ads from view via css, and then use Javascript to move the ad card nodes in between the offer cards every 5th card and then set their css to display again. Problem: My page is already rife with Javascript trickery...and this will be yet another computational expense that will slow down client side responsiveness...

OR...is there a much better approach that I'm just ignorant of (which is very likely, as I only just started using Drupal 8+ this summer)?
Thanks in advance for your help.

NOTE: I realize there are several questions similar to this one, but my question is slightly unique because I'd like to use a few of the user selectable filter parameters of the main view to filter the ads that I'd like to display/inject every 5th row so they are targeted ads


texts:
I want to save some details before saving the node, and I tried with hook_node_presave().

function hook_node_presave(Drupal Core Entity EntityInterface $node) {
  if ($node->id() && $node->moderate) {
    // Reset votes when node is updated:
    $node->score = 0;
    $node->users = '';
    $node->votes = 0;
  }
}

Then with hook_entity_presave().

function hook_entity_presave(Drupal Core Entity EntityInterface $entity) {
  $entity->changed = REQUEST_TIME;
}

Both hooks don't work. Why?


texts: Twig/variable support in Custom block HTML

texts:
I'm trying to understand if/how you insert Twig variables in blocks in the custom block library.

To clarify, the block's HTML has been configured via the UI at /admin/structure/block/block-content

Standard Twig syntax, e.g. a 'say-something' tag like {{ base_path ~ directory }} - which I want so I can set an <img src attibute correctly - doesn't seem to be parsed at all and I don't see a way to use Tokens.

Examining the HTML source with Twig debugging on, it's theme hook is listed as "field", so if I add a preprocess function:

function themename_preprocess_field(array &$variables, $hook) {
  xdebug_break():
}

that's being called rather too often
when it does reach the custom block, there doesn't seem to be anything in $variables that labels it as such, other than a render array with the processed text:

$variables['items'][0]['content]['#text']

What's the simplest approach for this? Is the only way to do it to write a module?

Thanks,
William


texts: Image wrapper by img tag with external url

texts:
I want to customize image field so as I am able to add external url and display in node without save locally.

The image is already online to another site. For example www.example.com/imageurl.jpg. The only thing I want to do is to wrap this on a drupal field like this <img src="www.example.com/imageurl.jpg"/>

Is there any solution?

Thank you


texts: How to work with translations on a date?

texts:
I am trying to render a translated date coming from an API and I am wondering what's the best way to do it.
The value coming from the API is formatted as "February 13, 2007"
I would love to keep this format for english language but to have "13 Février 2007" for french and "13. Februar 2007" for german.
I tried to strtotime() the value when I receive it and |format_date() it in twig - it works but the date is printed with the medium date format (D, m/d/Y - H:i).
For this medium format, the translation works as expected, in french I see the date formated as D d/m/Y - H:i as it is set in /admin/config/regional/translate.
But I want j F Y for french, F j, Y for english, j. F Y for german. Drupal core doesn't give this format so I created a custom date-time format for the undefined language with F j, Y as value.
The problem is that I can't translate this format from /admin/config/regional/translate like it's done for the core date-time formats.
Any clue?


texts:
I'm a newbie, so please forgive me if this is a dumb question.

Exactly what files does the "Export to Drupal archive" feature of Dev Desktop actually back up? I have searched the web and didn't find anything that would answer this question.

My understanding, at this point, is that I need to export/backup the database and my Sites folder. PhpMyAdmin will do an export/backup of the database, but I have to manually copy & paste the Sites folder and fool with all the settings in phpMyAdmin. It would really be nice if the Export to Drupal archive does this with only one click .

Thanks!


texts: Product Display - Can I redirect the page when selecting a product from the drop down on a product reference field w/ unlimited values?

texts:
When creating a product display, you can select an unlimited number of values on the product reference field. This adds the drop down menu that will load the different products when selecting them via ajax. The issue I am running into is I would like the page to redirect to those items when selecting them.

I have a related products view and a bill of materials view beneath the product display that depend on the contextual filter of the NID of the content on that page. (I think having a related products view plus multiple items on the product reference field is redundant, but it is what the client wants). Those views don't refresh when the product reference drop down is changed because the page never refreshes, so the NID of the page is still the same. I notice only the items that are attached to the product itself change via ajax such as the price, which does make sense since you are only grabbing the products via the product reference field, not the product display.

Is there any way to somehow redirect the page when the product reference field drop down is changed to a different product?  I feel like this can't be done since you are only grabbing the product information there, not the product display information. The product itself doesn't know if it is part of a display or not and I feel that is what the issue is.

If anyone has any suggestions or ideas they would be greatly appreciated! Thanks.


texts: Registration emails appear to be randomly delivered, regardless of the recipient domain

texts:
I recently built a Drupal 7 based website with the possibility for the visitors to register / apply for an account to view certain protected pages otherwise hidden from anonymous users.

I'm using the default process:

User applies for an account -> User (should) receive the "Welcome (approval required)" email -> Main site admin approves account -> User (should) receive the "Account approved" email containing the account details + the one time login to setup a password.

Everything is working as it should except the email bits. This is totally inconsistent and certain users receive the welcome emails and some users don't.

It doesn't matter what email they use: gmail, yahoo, hotmail, custom domains. For example I receive the welcome emails on my gmail account but not on an email address using a custom domain (email hosted at hostgator).

Furthermore, I've tested this with at least a dozen other emails, and I can't find a pattern.

Another important thing to mention is that the website is hosted on a Rackspace dedicated cloud server but the domain is only pointed to the server. The email records and NS records are on a different server. I only host the website, nothing else.

Could this be causing the issues? It's a domain trust / key issues perhaps? Or something to do with strict spam filters?

I would really appreciate some help with this.

Many thanks!

Edit: I just want to add the fact that I've added a few triggers too (using Rules) to replicate the email sending process but it's the same.


texts: Show video thumbnail and download link in view

texts:
I want to show a view page such that a grid of video thumbnails with download button below it will be displayed. As shown below:

I tried video module to display video. But it fails to give file path. Because of which I'm not able to achieve it.

Then I tried with normal file field. But I'm not able to show the video using file field.

I rewrote this file field as:

and then in Custom Text field I wrote below code.

{% if field_file_vid %}

{{ field_file_vid }}

Download

{% endif %}

In this case only download link is working not the video.

How to achieve this requirement?


texts: What is the difference between a JOIN and a RELATIONSHIP in hook_views_data_alter()

texts:
What is the difference between these two as implemented on hook_views_data_alter()? Why choose one over the other?

I did notice that in setting up a relationship between mytable1 and users tables, the Views UI gave me the option to add the mytable1.uid field under the relationship section, that way allows me to add users fields into the query.

What am I supposed to notice on the views-UI when I implement a join on a table? My implementation is as follows:

mymodule_views_data_alter(&$data){

    $data['mytable1']['table']['join']['users'] = array(
        'left_field' => 'uid',
        'field' => 'uid',
    );

}

I did this without a relationship setting, so I can observe the exclusive effect of each(join vs relationship)


texts:
I have a form builder containing the following code.

  $form['finput']['noreff1'] = array(
  '#type' => 'textfield',
  '#title' => t('No Reff1'),
  '#size' => 60,
  '#default_value' => $noreff1,
  //'#required' => TRUE,
  '#autocomplete_path' =>'noreff/autocomplete',
  '#ahah' => array(
      'event'   => 'change',
      'path'    => ahah_helper_path(array('finput')),
      'wrapper' => 'finput-wrapper',
     'method' => 'replace',
         'progress' => 'throbber',
  ),
  '#prefix' => '
', '#suffix' => '
',
  );

  $form['finput']['noreff2'] = array(
  '#type' => 'textfield',
  '#title' => t('No Reff2'),
  '#size' => 60,
  '#default_value' => $noreff2,
  //'#required' => TRUE,
  '#autocomplete_path' =>'noreff/autocomplete',
  '#ahah' => array(
      'event'   => 'change',
      'path'    => ahah_helper_path(array('finput')),
      'wrapper' => 'finput-wrapper',
     'method' => 'replace',
         'progress' => 'throbber',
  ),
  '#prefix' => '
', '#suffix' => '
',
  );

  $form['finput']['noreff3'] = array(
  '#type' => 'textfield',
  '#title' => t('No Reff3'),
  '#size' => 60,
  '#default_value' => $noreff3,
  //'#required' => TRUE,
  '#autocomplete_path' =>'noreff/autocomplete',
  '#ahah' => array(
      'event'   => 'change',
      'path'    => ahah_helper_path(array('finput')),
      'wrapper' => 'finput-wrapper',
     'method' => 'replace',
         'progress' => 'throbber',
  ),
  '#prefix' => '
', '#suffix' => '
',
  );

This code shows a fixed number of form fields (noreff1, noreff2, noreff3). If I want to dynamically increase those form fields, how can I do?


texts: Organic Groups Registration Codes / Keys

texts:
I am trying to set up a registration code/key for my site. I know these modules (listed below) assign a code or i can assign a key to each organic group.

The issue i am having that if i select Group A but provide code for Group B it puts the registered user in both groups A & B.

I would like it to work as follows: I provide Group A code, I select Group A from dropdown and then i will be put in that group. If i provide Group A code, but select Group B it should prompt an error or vice versa.

Any suggestions would help!

Module Links:

Organic Groups Registration Codes
Organic Groups Registration Keys


texts: How to create user input dependent form elements?

texts:
I have created a form and it has multiple elements. Is there a way to show specific form elements depend on a slelect box selected value.
For an example my select box has 2 options. if i select option 1, form will show a text box after the select box. if the selected option is 2, form will show a another select box
after the first select box.


texts: Drupal 7 not able to run cron after views/panels update

texts:
After an update of several modules to their latest versions (views, panels, ctools) it seems Drupal can no longer run cron, whether automatically or manual. It gives the error: "Cron run failed."

I have no idea what might be causing this and only discovered it some 10 days after performing the updates. The lightweight cron (for scheduled content) that I have set up externally in cpanel still runs.

Also a bit worrying is, when visiting mywebstie.com/cron.php (as an anon) it shows me my actual frontpage with some broken css. Which, I believe, is an unintended behaviour as it should show a blank page or a "content not found" page.

I believe the number 1 suspect is the views module, since immediately after the update I noticed that admin/content view no longer updates the "node views today" value and it just continuously increments this value without reinitialising every 24hours.

Any ideas of what might be the issue here?

Everthing was normal before the said updates: I have Unix server using Centos. BTW I have a local copy of the site using Xampp and it has the same cron problem as the live site. I am inclined to believe this is not a server problem.

PS: I have never used drush..


texts:
I've added a new Drupal user, so how do I make them an administrator of the site?

I can't seem to find a setting to do this? User roles are Authenticated and Anonymous.

But the default login username definitely has some kind of administrator permission. How do I grant this same privilege to a new user?

In Config > People there is setting Administrator role which is a select menu, but it only has the disabled option :S


texts: Search index keeps resetting itself to certain percentage done

texts:
On a productive site (Drupal 6) with roughly 2000 nodes the search index is stuck at 76% (saying 944 nodes are left to be indexed).

Besides 944 not being 24% of about 2000, it isn't changing persistently no more. If I run the cron, 50 nodes are indexed and /admin/settings/search states, that 77% are done and 894 nodes are left.

However, when only reloading that page, the displayed information is reset to 76% and 944 nodes left.

I tried to re-index, though it is not resetting to 0% but stays at 76% and 944 nodes left.

The MySQL table search_index has crashed about a week ago and I repaired it through phpMyAdmin (repair table option).

How should I proceed to get it all working again? Do I have to empty tables to start over? If yes, which ones should I empty?


texts: Validate a file extension using getMimeType

texts:
I want to create a hook that will validate a file upload and only allow jpg extension or a multiple array jpg, gif. I am not sure how to do this. If this  below can validate the length of the file title.

if (strlen($file
 ->getFilename()) > 100) {
    $errors[] = t("The file's name exceeds the 100 characters limit.");
 }

Then can something simular to this work?

use Drupal\Core\Form\FormStateInterface;
 function blank_moda_file_validate(Drupal\file\FileInterface $file) {
   $errors = array();

if ($file
 ->getMimeType()) !== jpg, gif) {
   $errors[] = t("The file is not a jpg or gif.");
}


texts: Why can't Drupal write to the database after migrate/restore?

texts:
When I want to do more development on a live site, I usually make a copy of the files and database on my local LAMP install and play with it there.

Now I'm finding that if I copy the database to local using Backup and Migrate or importing/exporting with phpMyAdmin, the local Drupal can only read from the database. It displays pages, but any edits or admin changes don't get saved. No errors, just nothing changes.

I've tried clearing all caches and running update.php. I'm running the same Drupal version live and locally. If I install Drupal locally from scratch, no problems at all.

What am I missing here... or is there a better way to achieve production/live cloning?


texts: Sub theme doesn't inherit base theme's style

texts:
I'm tryign to create a subtheme of Corporate lite (https://www.drupal.org/project/corporate_lite) following the instructions on https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme
I've created mytheme.info.yml

name: mytheme
type: theme
description: My custom child theme
core: 8.x
# Defines the base theme
base theme: corporate_lite
# Defines libraries group in which we can add css/js.
libraries:
  - mytheme/global-styling

# Regions
regions:
  slideout: 'Slideout'
  header_top_highlighted_first: 'Header Top Highlighted First'
  header_top_highlighted_second: 'Header Top Highlighted Second'
  header_top_first: 'Header Top First'
  header_top_second: 'Header Top Second'
  header_first: 'Header First'
  header: 'Header Second'
  header_third: 'Header Third'
  banner: 'Banner'
  system_messages: 'System Messages'
  content_top: 'Content Top'
  content_top_highlighted: 'Content Top Highlighted'
  content: 'Content'
  sidebar_first: 'Sidebar First'
  sidebar_second: 'Sidebar Second'
  content_bottom_first: 'Content Bottom First'
  content_bottom_second: 'Content Bottom Second'
  featured_top: 'Featured Top'
  featured: 'Featured'
  featured_bottom: 'Featured Bottom'
  sub_featured: 'Sub Featured'
  highlighted_top: 'Highlighted Top'
  highlighted: 'Highlighted'
  footer_top_first: 'Footer Top First'
  footer_top_second: 'Footer Top Second'
  footer_first: 'Footer First'
  footer_second: 'Footer Second'
  footer_third: 'Footer Third'
  footer_fourth: 'Footer Fourth'
  footer_fifth: 'Footer Fifth'
  footer_bottom: 'Footer Bottom'
  sub_footer_first: 'Subfooter First'
  footer: 'Subfooter Second'
  hidden_blocks_collection: 'Hidden blocks collection'

and mytheme.libraries.yml

global-styling:
  css:
    component:
      css/style.css: {}

Both files are placed in a folder called mytheme.
When I enable my custom theme it doesn't load any of the base theme's style. My custom css placed at mytheme/css/style.css it's loaded, though. What am I doing wrong?


texts: Is allowing Full HTML (HTML filter on) input for all user roles safe?

texts: Is allowing Full HTML input for all user roles safe as long as I enable the HTML filter?


texts: I want to validate comments using a custom module; I am using hook_comment(), and "validate" as value for $op, but I cannot get the value of the comment field. How do I get the comment value from a custom module?


texts: How to identify which Rule is triggered?

texts:
I have a collection of email notifications created with Drupal Rules module and a separate custom database table with the ID's of the rules and emails to exclude from individual notifications.

I need to know which rule is being triggered so I can query my custom table for the correct emails to exclude. Creating custom conditions would not work because I have 20+ rules using the same custom action.

The only hook that I can find that is triggered after a rule is executed is hook_rules_config_execute but it does not give me information only on the specific rule that triggered.


texts: How add a function in a condition method in db api

texts:
I am strugginling to find out how to execute the below query using drupal's db api
$startdate = '1491001200';
$enddate = '1498690799';
"SELECT * FROM field_data_field_symposium_event_time
    WHERE UNIX_TIMESTAMP(field_symposium_event_time_value) BETWEEN
    $startdate AND $enddate;"

I have tried adding 'addExpression' but does not work. I did it like this
$query = db_select('node','n');
$query->join('field_data_field_symposium_event_time', 'et', 'et.entity_id = n.nid');
$query->condition('et.field_data_field_symposium_event_time_value',array($day_start, $day_end), 'BETWEEN'));
$query->addExpression('UNIX_TIMESTAMP(et.field_symposium_event_time_value)');
$query->fields('et',array('field_symposium_event_time_value'));
$result = $query->execute()->fetchAll();

The $result is empty. Is there a way to achieve this  as I dont want to write the full query .


texts:
I am running into a problem similar to
Syntax error: <!DOCTYPE html> (line 1) in Firebug

I have a custom module that is creating blocks on specific urls.  The error is showing up on other pages that do not include the blocks.  I get the syntax error below in firefox and when I scroll down when viewing the source there is an empty script tag.

SyntaxError: syntax error
<!DOCTYPE html>

<script src="?n6yboi"></script>

I have went thru my entire module and commented out all the drupal functions that are loading js files and still get the error.

Any ideas on what may be causing this?


texts: Indexing on related nodes but not including them in search results

texts:
I have two node types, List and Links. Each List has many Links, and is referenced by the entity reference field in the link node. Each Link only has one List.

I'm trying to get the Search API to Index the data in the Link nodes that are associated to the List (such as title and description), but only want List nodes to show up in search results.

For example.... If I have a List called 'My fave types of pasta', and three Link nodes called 'Spaghetti', 'Penne' and 'Fusilli', all of which have an entity reference to the original List node. Now if I were to put 'Spaghetti' into my search I would want the 'My fave types of pasta' List to come up in the search results.

How can I do this?

Also, as a second step, how can I influence the List node title to be higher weighted importance than the Link node title?

I have read what feels like everything I can about the Search API so please forgive me if I've asked a question with an obvious answer!


texts: Turning on performance breaks Drupal (PHP fatal error)

texts:
I am not certain if I turn on CSS/JS aggregation or caching which breaks Drupal.

The error I get is similar to this:

  'home/user/mysite.com/commons/includes/includes/bootstrap.inc' does
  not exist.

I can see that includes folder has been repeated twice. When I turn off (by overwriting the whole database) performance the problem is fixed.
I have also tried to truncate the cache tables with no effect.
Is this something that someone else has come across?
does anyone know where the performance variables are stored in the MySQL tablesso that when my website breaks I can turn them off from PHPMyAdmin?


texts: How do I make block only visible if the 'field_date_value' is in the past?

texts:
What code do I use on a D7 website if I want a block only to be visible if the field_date_value of a date node is in the past?

On a D6 site, I had this working for all date nodes:

$match = FALSE;
$types = array('date' => 1);
if (arg(0) == 'node' && is_numeric(arg(1) )) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}
return $match;

But this code does not work on a D7 site. Besides, all that I want is it to only show a date node when the date in the past. (For a past event.)


texts:
I'm running Drupal 7.34 and Webform 7.x-4.9/Webform Layout 7.x-2.2.

I've put together a webform to be used for customers to fill out their data. If I select Label Display "Above", it disappears and no labels show. If I set it to "Inline" it works better, but the spacing is goofy (see link).

How do I set it so that the "Above" label display works, and how do I control setting up the spacing (so that I can have only one on a line)?

Thanks in advance for any help you can provide.


texts: How do you allow a user to set the audience of a node to any Organic Group without giving them the "administer nodes" permission?

texts:
I have a group of users that I need to be able to set the audience of story nodes to any of the Organic Groups within our systems.  Is there a way to do this without giving them the "administer nodes" permission.

I am currently assuming this isn't possible with my current set-up but was hoping there is a module out there that would allow it.

If there isn't a module where would I begin to look at creating a module that created this permission?  What Drupal API hooks would I begin with?


texts: How to get the destination nid from an URL object

texts:
In a preprocess function I want to access the destination node id via the URL object
I cannot find any method that will return the node id for me but I can clearly see that it holds the node id. (see attached)

Any idea how I can get the node id without going the long way of generating it from the URL path?


texts: Highlight autocomplete suggestions Drupal 7

texts:
I have a text field in a form, with autocomplete on. It works very well, but I cannot manage to find a way to highlight the letters in the suggested works. I found this hack in the autocomplete library (general, no Drupal related), but don't know if it applies or how to apply it. I would like the same effect:

http://output.jsbin.com/ezifi/4


texts: How to use non-minified js (e.g. jQuery) for debugging/development?

texts:
Background
Drupal core contains some 3rd party javascript libraries, among them jQuery. Typically such libraries are available as un-minified and minified versions. A minified js file can have a reference to a source map via sourceMappingURL, which can be used by the browser developer tools to show the original source.
Since https://www.drupal.org/project/drupal/issues/1341792, js files like jQuery are shipped as a minified version.
In https://www.drupal.org/project/devel/issues/2471919, it was considered to add an option in devel to send the un-minified version instead. This was discarded because we can use source maps.
The minified jQuery.min.js used to have a sourceMappingURL reference, but this is gone in newer versions.
I also found some issues talking about warnings and errors from files with sourceMappingURL, if the referenced source map is missing. But I don't know if these are related.
Problem
There seems to be no way (besides hackery) to see the original js file (e.g. original jQuery.js) for debugging in the browser.
EDIT: The browser can prettify the js, but it cannot un-minify the variable names or restore comments. So I do not consider this a sufficient solution. I should have mentioned this directly.
Question
Am I missing something? Is there a hidden option or contrib solution to make the source maps work, or to use the un-minified jquery.js for debugging during development?
(depending on the answer, I might open an issue on drupal.org)


texts: Is there a D7 module to do an Ajax based test if a username is available, in the same way done on https://en.wordpress.com/signup/?


texts: How I can disable block view from database D7

texts:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

I have Last error, this error will be resolved when a user increase max allowad packet Im do it and set it 500MB, and Im clearing cach from DB, and Im restart a mysql server ..but not working

any way this error was trigger when Im try to save a block was creation in view, I think I know where is problem, its in filed in this block was add manually .. but now I need back to disable block to I can maintenance a problem, how I can do that ..

or there another way to resolve this problem ..

thanks alot


texts:
Created a content type and add taxonomy form in it using Inline entity Form module.

So, the rendered taxonomy add term looks like :

What I want to do is ADD CUSTOM VALIDATION to the "NAME" field.

I tried:

function hook_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  //kint($form_state->getStorage('inline_entity_form'));die;
  // $entity = $form_state->getFormObject()->getEntity();
  //   $nid = $entity->get('name')->getValue();
  $userInput = $form_state->getUserInput();
 // kint($form_state->getUserInput()['field_plan_features']['form']['inline_entity_form']['name']);die;
 // $form_state->setErrorByName('name', t('Term already exists in taxonomy blah'));
}

How it can be done.. please suggest some way.


texts: Expose all Drupal Webform submissions data in one view?

texts:
I'm trying expose all Drupal Webform submissions data in a single view with a contextual filter.

I have tried the Webforms MySQL Views module, and I think that is exactly what I am after, except you have to do the same process for every form (e.g. http://vimeo.com/18701843 & https://www.drupal.org/node/1658784).

My website allows for users to create their own webform which means there could be thousands of them that I'd have to create the MySQL View for and that's not really feasible.

Is there a way to either automate this, or create one view for all webforms?


texts:
I am totally new to Drupal trying to build a CMS just as a data entry level to gather data,
I built a Service View that will retrieve the content of the node and show it as a JSON object , I have a content type with field collection in it , this field collection contain a Text Field that has Field Translation enabled, users can enter the data in the enabled languages.
My service works well but it only retrieves the data according to the Field Language option under the Advanced tag when defining the service.

My Question is how can I get the data in the language I request ? Is this even possible ?


texts: How to add a product into cart using commerce services

texts: I want to add a product into cart using services . So i had installed services and commerce services also .I know a product add to cart using commerce api but i don't know how to add a product using service.I don't know which variable are to be passed to url using services for adding a product to cart


texts: Comparing and manipulating webform results

texts:
I'm trying to set up a webform survey (all multiple choice) that allows people within a community to be matched with a partner that shares similar interests to them.

Essentially, I'm looking for a way to compare results from a webform so that I can determine matches between submissions. Once a match has been found, I'd like to delete those submissions (Or effectively remove them from the pool of submissions).

Is that possible with webform, or should I be looking for another module/method? Initially I was looking for a way to feed webform responses into a SQL table, but that doesn't seem to be possible.


texts: Adding JavaScript and CSS to a particular menu page

texts:
I have set up a Drupal 7 web site with a few custom blocks and menus written by me.

I have a non-Drupal PHP script displaying users (some of them are external, i.e. not stored in drupal tables) as a table with the DataTables jQuery plugin.

I would like to rewrite that script as a Drupal menu, so that it can be called as http://preferans.de/top.

The content of my.module is the following.

function my_menu() {
  $items['top'] = array (
    'title' => 'Top',
    'description' => 'Top',
    'page callback' => 'my_top_callback',
    'access callback' => TRUE,
    'file' => 'my.top.inc',
    'file path' => drupal_get_path('module', 'my'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

The content of my.top.inc is the following.

function my_top_callback() {
  return array (
    'top_table' => array (
      '#type' => 'markup',
      '#markup' => generate_html_table_with_php(),
    ),
  );
}

My problem is that I don't understand how to add the CSS and JavaScript code, so that it is available for the /top page, but not for any other Drupal paths.

I should probably call:

   drupal_add_css('/demo_table_jui.css', 'file');
   drupal_add_css('/smoothness/jquery-ui-1.8.4.custom.css', 'file');
   drupal_add_js('/jquery.dataTables.min.js', 'file');
   drupal_add_js('
       $(document).ready(function() {
         $("#rating").dataTable( {
            "bJQueryUI": true,
            "sPaginationType": "full_numbers"
          });
        ', 'inline');

(Please see the head-section of my original non-Drupal script).

How do I limit these calls to the /top page and where should I perform these calls?
Should I put them in a hook, or by adding some properties to my menu?


texts: Load the value of an entity field type in another form

texts:
I have created a custom field and I wish to load the value dynamically in another form in relation to the specific node entity the value belongs to.
I understand that to get the value I have to use/know the field_name like this

$entity->get('field_name')->getValue();

What I want is to get the field_name set via content configurations with only the type of node and the field name as defined in the fieldItem Plugin

$field_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('node');

When I dump $field_definitions am able to see all the fields array with all the details but I can't get my node.field_name in relation to the fieldItem name defined in the specific field plugin, in my case field_custom_example

/**
 * Plugin implementation of the 'field_custom_example' field type.
 *
 * @FieldType(
 *   id = "field_custom_example",
 *   label = @Translation("Custom Example"),
 *   description = @Translation("Stores data for Custom Example Field"),
 *   default_widget = "custom_example_widget",
 *   default_formatter = "custome_example_formatter"
 * )
 */

that's where am stuck.


texts: Why does drupal_http_request return a 400?

texts:
I am having issues sending a POST via my module.
In my browser's REST client I get a 200 with
POST https://mydomain.com
username=myuser&password=password1

So I know that the service is working fine.
I tried to replicate this call in my Drupal module with
$url = "https://mydomain.com";
$data = array(
    'username' => 'myuser',
    'password' => 'password1',
);

$data = http_build_query($data, '', '&');
$options = array(
  'method' => 'POST',
  'data' => $data
);

$response = drupal_http_request($url, $options);

The response I get is a 400. according to this I am not constructing the request correctly.
Question: How should I change my code in order to get a 200?
Note: I am using Drupal 7.
Thanks.


texts: how to add next and previous link on content full display page on tpl file in drupal 7?

texts:
I have a content type called flower and I have created a node--flower.tpl.php for displaying products.

I am also using category of flowers. I need to add next and previous links on this page for a specific category. For example if I'm on rose page then all roses are needed to show on next and previous link, not other category data.


texts: Share this button affects front page menu when blog is promoted to front page

texts:
I am using the Share This module in Drupal 6 to put a button in blog page only, and when I am promoting a blog entry to front page my primary link menu displays with incorrect CSS.

Is there a conflict between the ShareThis CSS and my theme? How can I resolve it?


texts: How to set a session variable when a link is clicked?

texts:
I have created a search block. It outputs multiple results (names) as links.
User can follow the link. How can I pass the user name into $_SESSION variable?
I tried doing this, the result shows a page not found error.
'name' => l(t($n['name']), 'edit_details' ,array('query' => array('uid' => $n['uid'])))

In hook_menu() I set $items['edit_details/%'] to array(). I passed the value into the session with $_SESSION['id'] = $_GET['uid'];.


texts: We're converting a site to be responsive and have decided to use Adaptive Theme. But the client insists on a unique layout for the Front page that does not fit into Adaptive's method of stacking sidebars. In principle I need a layout program like Panels or Display Suite that lets you create two layouts, and then decides which one to use depending on the device. I'm a coder and can do this myself with a page callback, or I suppose in the front page template, but was hoping for another solution. Is there a better way?


texts:
I have this project that an agent(user) is having a commission on every product that they are selling. The admin should pay the commission through the back end side by using the payment information (paypal email or any) provided by the agent.

What module should I use on this one?


texts: How to add a theme preprocess function for published state?

texts:
I want to create a body class for the published state of a node. I found some suggestions below for Drupal 7, but this code is not working for my Drupal 8 theme.

Add class based on published state

How can I acheive this?


texts: Drupal Commerce Paypal: Order information at Paypal

texts:
I am using drupal commerce paypal. When a client is directed to the paypal site, then by default this information is shown: Order  at .

How can I configure the information shown here?

thanks for any help


texts: How to get user.field value in node--teaser.twig

texts:
That's how I getting user.field value for node--full.twig but this code does not work for node--teaser.twig

function MYTHEME_preprocess_node(&$variables) {
    if ($node = \Drupal::routeMatch()->getParameter('node')) {
              $variables['author'] = $node->getOwner()->field_name->value;
    }
}

}

Any ideas?


texts: Add product fields to cart form through line items

texts:
So I have a Product field called "Quantity Per Box". It's a field that says how many items (in this case, screws, nuts, and bolts) come in each box. I want to display this number in the view when the customer goes to cart.

I have the field as part of the product already. What I have done so far is added the existing field to line items, and checked the box to add that field to the cart. Then I edited the view to add that item. The label shows up "Quantity Per Box" but there is no value in the field from the product. I've tried this several different ways with no success. Can someone help me out here, what am I missing?


texts: What is the best way to redirect node to node

texts:
I am trying to figure out what is the best way to create a redirect from one node to another.  For example, say we have two nodes:
node/1 | path-one
node/2 | path-two

I created the following redirect:

But when visiting path-one it still shows node/1 instead of redirecting to node/2.
The only way I can do it is to remove the path alias for node/1 and then it works.


texts: Trouble Hiding Regions When Blocks Are Empty

texts:
Having trouble seeing why my regions render when I think they shouldn't...

page.html.twig:

{% if page.region %}
  {{ page.region }}
{% endif %}

region.html.twig:

{% if content %}

    {{ content }}

{% endif %}

block.html.twig:

{% if content %}

  {# Label. If not displayed, we still provide it for screen readers. #}
  {% if not configuration.label_display %}
    {% set title_attributes = title_attributes.addClass('visually-hidden') %}
  {% endif %}
  {{ title_prefix }}

{{ configuration.label }}

  {{ title_suffix }}

    {% block content %}
    {{ content }}
    {% endblock %}

{% endif %}

block--system-messages-block.html.twig:

{% extends "block.html.twig" %}

{% block content %}
{{ content }}
{% endblock %}

I believe it has to do with my extended block templates. These seem to be the ones that will still render even when there is "no" content.

What am I missing? If I use an if check around {% block content %} Twig throws an exception, inside there is no effect.

Adding |render|striptags|trim|length > 0 in any of these templates doesn't seem to solve the issue, and in some cases, forms and Drupal messages don't validate (so nothing returns when it should).


texts: Programmatically change field type from 'Plain/Long' field to 'text_format', 'full_html' field in node

texts:
I am trying to change the 'Plain/Long' paragraph field to 'text_format', 'full_html' field.
I am able to change the field to rich text field with below code, but when I try to save the node getting the error 'This value should be of the correct primitive type.'
function mymodule_field_widget_entity_reference_paragraphs_form_alter(&$element, &$form_state, $context) {
  if ($element['#paragraph_type'] == 'my_paragraph_name') {
    $element['subform']['field_paragraph_myfieldname']['widget'][0]['value']['#type'] = 'text_format';
    $element['subform']['field_paragraph_myfieldname']['widget'][0]['value']['#format'] = 'full_html';
  }
}

Tried to implement referring to URL:https://www.advomatic.com/insights/adding-a-wysiwyg-to-text-fields-in-drupal-8-and-9
The blog post is working fine for normal Drupal field, but not for Paragraph field.
Please suggest a way to change the plain text field to Rich Text Formatted field in Paragraph and save the formatted data in node.
Note: Will not be able to implement hook_update_N or create a new field and perform migration.


texts: Taxonomy shows term ID not term name in Facet API

texts:
Im trying to facet by taxonomy fields but I see just the ID, not the name of the term, why?

I'm getting this:

3 (76)
4 (35)
176 (7)
167 (6)
177 (5)
168 (4)
5 (2)
163 (1)
7 (1)

and it should be

Casa (76)
Depto (35)
Duplex (7)
...

Any ideas?


texts: How can I take a site offline using Drush?


texts: Drupal 7 + Solr - Importing feeds after website restore leads to 1062 Error

texts:
I’m developing on localhost, using Drupal 7 with the Search API with Solr module. After performing a restore from backup, I needed to reimport several items from a feed. I set up my feed importers, using the Node ID as the unique target. However, after conducting the import, it always returns failure. The error report is a long list of:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '62911-1' for key 'PRIMARY'

(The Duplicate entry number is different for each line.)

There are no nodes or actual content on the site, which leads me to believe that it is something in the database. Could be wrong, though.

I have done the following things to try and rectify this problem, with no luck:

Changed “Do not replace existing nodes” to “Update existing nodes” in
the Node Processor settings.
Changed “Update existing nodes” to “Replace existing nodes” in the
Node Processor settings.
One search made me realize that my Solr server wasn’t automatically
starting, so I did that and then ran the import; no luck.
Rebuilt user node access permissions.
Installed “Delete All” module and deleted all content, resetting the
node id counter from 1.
Cleared the Solr index from within Drupal.
Deleted all items from within the Solr core itself (although the
Index status page at
admin/config/search/search_api/index/default_node_index still has
“172/60857 indexed” under the status bar. This was the only partial
success, as it managed to import 172 items, but the rest still
received the error.)

Not sure where the problem is. I suppose I could just try and use GUID as the unique target, but I don’t know if that will work. (I’d also like to keep using the Node ID if possible.) I could also try to completely remove the Solr module from Drupal 7 and trying again, which I think will be my next step. However, I am really looking for any thoughts on this. Have any of you encountered this problem before? What have you done to fix this?


texts: Display vocabularies/terms inside content-type view

texts:
I'm working with D7 and Views 3.  I created a view for my term pages (type=content, to show all my tagged content, which is a products' catalog). So far so good.

But now I would like to display in the same term page the vocabulary to which the selected term corresponds, along with all its siblings-terms, and a list of all the other vocabularies (without their terms), so the user can click on them and change the product category they're viewing.

I have my catalog like this:

Vocabulary A
 - Product A1
 - Product A2
 - Product A3

Vocabulary B
 - Product B1
 - Product B2
 - Product B3

Vocabulary C
 - Product C1
 - Product C2
 - Product C3

And I'm trying to have this in my view (supposing I'm viewing product C2):
 Vocabulary A
 Vocabulary B
 Vocabulary C
 - Product C1
 - Product C2 (selected)
 - Product C3
 Plus the other fields that belong to my product content type.

The idea is that the user can easily move between categories, and have the current category they're viewing with all its terms displayed.

Can I accomplish this with a single view? I tried adding taxonomy:name, term:name, etc as fields to my current view but I just managed to display the current term name and that's it. Can I create a taxonomy view inside my content view? or maybe this can be accomplished with arguments and relationships?

This is my first Drupal site so I'd appreciate any suggestion to know if I'm on the right track.

Thank you!


texts: Extending the content administration pages

texts:
I have a lot of different content-types and many of them refer to other content-types.

In the administration it's becoming harder and harder to find a specific node, so I was thinking of writing my own theme and possible a module to make the administration easier.

It would be nice to have a free text search box in the administration, that would let one search for nodes of specific types.
Also in the listing of found nodes it would be great to be able to add specific fields so that you could see the relation between different content-types and so on.

Right now I'm using hook_menu to add a new page with a link link for each content-type, then in the callback I collect information about all nodes using a simple db_query call and then display the result using theme('table',...).

Can anyone point me to some tutorials on how to achive this?


texts: Call-time pass-by-reference has been deprecated in phptemplate_init() with specific theme

texts:
I installed the last Drupal 7 Stack from BitNami. It seems to work correctly with the default themes but when I switch to the twitter_bootstrap theme (7.x-2.x-dev at http://drupal.org/project/twitter_bootstrap ) the "Call-time pass-by-reference has been deprecated in phptemplate_init()" appears.

I look at the phptemplate.engine file but can't pinpoint the issue at line 14 (_include_once DRUPAL_ROOT . '/' . $file;_)

<?php

/**
 * @file
 * Handles integration of PHP templates with the Drupal theme system.
 */

/**
 * Implements hook_init().
 */
function phptemplate_init($template) {
  $file = dirname($template->filename) . '/template.php';
  if (file_exists($file)) {
    include_once DRUPAL_ROOT . '/' . $file;
  }
}

/**
 * Implements hook_theme().
 */
function phptemplate_theme($existing, $type, $theme, $path) {
  $templates = drupal_find_theme_functions($existing, array($theme));
  $templates += drupal_find_theme_templates($existing, '.tpl.php', $path);
  return $templates;
}


texts:
I'm dumping the database every 2 days, but I noticed that at some point last month the database jumped from around 500 MB to 4 GB!

What can be the cause of it?


texts: Adding a background image for Omega subtheme

texts:
I've created a custom sub-theme for Omega and I want to change the background of the body to a specific image. I've edited the global.css file in the css folder of my subtheme.

body {
    background-image:url("images/starbkg.png") repeat;
     }

I've also made sure that global.css was enabled.  If I add background-color:black to the code the background does change color but I haven't been able to change the background image. I figured just by editing the global.css file I should be able to change the background image. No matter how many times I've flushed the cache and reloaded the page, the background image still won't show up. I've even tried creating a preprocess file. In the preprocess folder of my theme.

<?php
/**
* Preprocess HTML.
*
* Implements hook_alpha_preprocess_html().
*/
function myth_preprocess_html(&$variables) {

  $variables['classes_array'][] = 'body';
}
?>

(myth is the name of my theme)

I don't need the background to re-size or change, I just want something that sits behind all the other areas on the page and is persistent across all the content.
When I inspect the page I find that

<body class="html front not-logged-in page-node omega-mediaqueries-processed alpha-  debug-processed responsive-layout-wide">

hasn't changed to indicate a background.
I've looked into various modules that I would like to avoid and I was hoping to find something relatively simple. I have managed to change the background on non-Omega based themes so I suspect there is something that Omega does that I'm missing.

Thanks in advance for your assistance.


texts: Concurrently updating field data results in lost updates

texts:
I have a field_whatever (allows unlimited values) on the user entity and this API endpoint:
# mymodule.routing.yml
mymodule.foo:
  path: "/api/foo"
  defaults:
    _controller: '\Drupal\mymodule\Api::foo'
  methods: [GET]
  requirements:
    _access: "TRUE"

# Api.php
  public function foo() {
    $user = \Drupal\user\Entity\User::load(1);
    $user->get('field_whatever')->appendItem(\Drupal::request()->query->get('value'));
    $user->save();
    return new JsonResponse("", 204);
  }

I then issue these (obviously async) XHRs on my browser console in one go:
fetch('/api/foo?value=111'); fetch('/api/foo?value=222'); fetch('/api/foo?value=333');

All of them return a 204, which, to the client should mean that every value was persisted. Unfortunately though, most of the times (99%) the ending value on the user's field will be just one of the three requests (e.g just [333] instead of [111, 222, 333]) and it'll be the one of the last transaction which committed.
By inspecting the queries via set global general_log = 'ON'; I can confirm the lost update. The sequence for just one of the updates looks like this:
// reading of field value must happen here
...
START TRANSACTION
...
DELETE FROM user__field_whatever WHERE entity_id = '1'
INSERT INTO user__field_whatever (entity_id, ..., field_whatever_value) VALUES ('1', ..., '222'), ('1', ..., '333'), ...
...
COMMIT

Any ideas on how to solve this? Things I've tried:

Make those XHRs sync but this is not appropriate since different clients or servers can hit my API concurrently.
Lock and let the client know that the update failed so they can retry:

  try {
    $lock = \Drupal::lock();
    if ($lock->acquire('mymodule.foo')) {
      // do read, update, save here
    } else {
      return new JsonResponse("", 500); // throw some error code to let the client know that we did not update value so they can retry
    }
  } finally {
    $lock->release('mymodule.foo');
  }
  return new JsonResponse("", 204);

Wait until the lock can be acquired on the backend, so the client always succeeds and is unaware of the backend issue. This leads to complex backend code of course, and the serious possibility that a stale lock will lead to DOS in case a lot of backend threads end up waiting for the lock which will never be released.
Try to explicitly start a transaction as early as possible to make sure that the data is pulled from the database before the save:

$transaction = \Drupal::database()->startTransaction();
$user = \Drupal\user\Entity\User::load(1);
...

but the effect is exactly the same.
Is there another way?


texts: I have been a little frustrated with trying to get outside applications to consume services. The services browser is invaluable in testing the services themselves but fails in helping test the servers. For instance, if I do a views.get in the service, it returns an array (php) with node references. When I try the JSON server module, it does not return the node references. Are there any recommendations on how to test different service functions out through JSON? I though that a PHP file could be written to do this, but I wanted to see if anything out there exists alreay.


texts: Site is bricked; think it has to do with Contact Storage module

texts:
I built a Drupal 8 site about a year ago and installed the "contact storage" module to keep a database of contact messages. Last week I upgraded Drupal core to 8.2.3. After the install I ran the update script and I had a pending update:

  views module

  • Fix views with serializer dependencies.

When I attempted to run the update, I received the following error message:

  views module

  Update serializer_dependencies

  Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The
  "entity:contact_message" plugin does not exist. in
  Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of /core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

I've tried two fresh installs with the same problem. From the best Googling I can do, I believe that the problem is related to the contact storage module I installed earlier. I believe that I may have patched a script to get it working, but at this point I honestly don't remember and I don't have any backups (lesson learned). Almost my entire site is "bricked" now because of this — the only pages I've found that load are the login page and the Extend page (but not the Uninstall tab).

Does anyone have any ideas as to what may be wrong and how to fix it? Much appreciated.


texts:
From database design perspective, Why does Drupal even create these tables? They are so much alike. There are modules & methods for getting rid of these tables, But why are they there?

MariaDB [park]> describe field_data_body;
+--------------+------------------+------+-----+---------+-------+
| Field        | Type             | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+-------+
| entity_type  | varchar(128)     | NO   | PRI |         |       |
| bundle       | varchar(128)     | NO   | MUL |         |       |
| deleted      | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id    | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id  | int(10) unsigned | YES  | MUL | NULL    |       |  ONLY DIFFERENT ONE
| language     | varchar(32)      | NO   | PRI |         |       |
| delta        | int(10) unsigned | NO   | PRI | NULL    |       |
| body_value   | longtext         | YES  |     | NULL    |       |
| body_summary | longtext         | YES  |     | NULL    |       |
| body_format  | varchar(255)     | YES  | MUL | NULL    |       |
+--------------+------------------+------+-----+---------+-------+
10 rows in set (0.00 sec)

MariaDB [park]> describe field_revision_body;
+--------------+------------------+------+-----+---------+-------+
| Field        | Type             | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+-------+
| entity_type  | varchar(128)     | NO   | PRI |         |       |
| bundle       | varchar(128)     | NO   | MUL |         |       |
| deleted      | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id    | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id  | int(10) unsigned | NO   | PRI | NULL    |       |  ONLY DIFFERENT ONE
| language     | varchar(32)      | NO   | PRI |         |       |
| delta        | int(10) unsigned | NO   | PRI | NULL    |       |
| body_value   | longtext         | YES  |     | NULL    |       |
| body_summary | longtext         | YES  |     | NULL    |       |
| body_format  | varchar(255)     | YES  | MUL | NULL    |       |
+--------------+------------------+------+-----+---------+-------+
10 rows in set (0.00 sec)

MariaDB [park]>


texts:
I have a view that displays terms hierarchically via a view attachment, but neither the URL nor the breadcrumb keep track of where it is in the hierarchy. For example, a taxonomy structured like the following.

Category

Term I

Term A

Term 1

Term II

Term B

It displays a page listing Term I and Term II. Upon clicking on Term I, the user is taken to the page for Term A, which is a list of its sub-terms (Term 1). Upon clicking, the user is taken to a list of nodes tagged with that therm.

The path and breadcrumb for each of these pages is, sequentially, the following.

/category
/category/term-i
/category/term-a
/category/term-1

I would like instead for the breadcrumb and path to be the following.

/category
/category/term-i
/category/term-i/term-a
/category/term-i/term-a/term-1

I've tried the Hansel and Custom Breadcrumbs modules, but I have been unable to configure them properly, or they just don't provide the functionality I need.

I'm using Drupal 7 with a theme based on Omega, so any answer that include instructions to insert code into template or other theme files need to include information about where that code belongs in Omega.


texts: Field with '#type' = 'hidden' in hook form alter doesn't show #id in the source and it's not possible to show it with jQuery

texts:
I put in my template.php an hook_form_alter function where I assign '#type'= 'hidden' to "field_bergamo".

But I want to show it when in the select list "Provincia" of the same form
I select the option "Bergamo".

I suppose to solve with jQuery, but in the inspector of the page I can't
see the
"#edit-field-bergamo" ID, only the name.

I tried "jQuery ('input[name="field_bergamo"]').show()", it doesn't work.

If I don't assign ['#type'] = 'hidden' to "field_bergamo" in
hook_form_alter I can see the
"#edit-field-bergamo" in the inspector and
the jQuery commands .show() .hide() work correctly.

Why if I assign ['#type'] = 'hidden', the field doesn't have an ID and
doesn't react to my jQuery commands?

Any solution?

P.S. I can't use Conditional Field because the select list "provincia" is
inside a field type "Postal address" and is not singularly accessible.

And I don't like to install a module if not strictly necessary!


texts: How to make diffrent registration form for diffrent role

texts:
I want to make a registration form that be different for efferent role.
At the first I use the auto assign role for that the user can choose the role.
At now the user can choose him-self's role.
I want if he(or she) choose role "A":
He should answer some field like phone number
and if he(or she!) choose role "B"
He should answer some other field like home address but he cant answer the "phone number" by choosing this role
What should I do?
Is there any module?


texts:
Using Drupal 8 and the new webform module "8.x-5.0-beta19".

Like it a lot! Many options now to control the webforms.

Problem:
I have one input field 'NUMBER'.
When the web visitor enters a number greater than 0... the other input field should appear.
So on the second input field, I do a conditional statement.

Make visible when Value is not ---> 0

Seems to be this options only accepts integers greater than 0, but not 0.
See image... When saving the 0 disappear and 2 he accepts and does save it....

Is this a bug... does somebody has a solution?

Thanks for reading.


texts: Differences between Firefox and Chrome in the Omega theme

texts:
I'm building a site in Omega, and I'm having trouble understanding why Firefox is so much different than Chrome/IE. For example, in the menu bar, the font is fine and the text has plenty of room on the right side; in IE and Chrome, the font is much larger and the text wraps to another line. The display width doesn't seem to be that much different. Zooming in and out don't seem to matter.

Why does it seem to fit like it should in Firefox, but not IE/Chrome? How can I control that?


texts: How to find in a node template file that node is loaded directly or from 'node_load' function?

texts:
I want to check, in a node template file (node-node-type.tpl.php), that code is executing because of a direct request from a user visiting a node page or from calling node_load function in somewhere else?

EDIT:

the problem was 'Number of posts on main page' option in 'Post settings'. its value was 30 (I don't remember why I set it to its maximum value but I'm sure there was a reason that wasn't related to it's true functionality I think it triggers something else).

now that we know problem is from 'Number of posts on main page' option how I
can I fix it?
why this option invokes node template file despite the fact that I use a custom page.tpl.php which doesn't call node_view at all?


texts: How can I copy block placements and settings between themes?

texts:
How to copy blocks placement and settings between themes? suggests that, in Drupal 7, I could run the following two SQL queries to copy block placements and settings between themes.

DELETE FROM block WHERE theme = 'NEW-THEME'

INSERT INTO block (module, delta, theme, status, weight, region, custom, visibility, pages, title, cache, i18n_mode) (SELECT module, delta, 'NEW-THEME', status, weight, region, custom, visibility, pages, title, cache, i18n_mode FROM block WHERE theme = 'OLD-THEME')

What is the equivalent query/method I could use to achieve the same task in Drupal 8?