texts: Receiving Error message on every attempt to add or remove content. Is this normal?

texts: New to drupal & collaborating on a project. Error message reads "Error ; The website encountered an unexpected error. Please try again later." I've been getting that error message for 4 days in a row. Wondering if there is actually a site issue (with Drupal) or if there's something I can do to fix this.


texts: Displaying HTML entities in title through a view

texts:
I have a site (D7) where I need to have HTML entities in the title like the copyright, trade mark signs with the subscript tags. Like:

Product name®

The solution at the node level is simple using the page.tpl.php:

<?php print html_entity_decode($title); ?>

But in a view no matter how I try to format the title it will always return it like

Product name<sup>&reg;</sup>

I try a formatter, but they don't reach the title. Any other ideas?


texts:
I've been away from Drupal a few years. I now want to develop a site. I see it's up to version 9. However, when I tried to install Drupal 9 in DevDesktop to get a feel for it, I got the message PHP version too old. I'm selecting the highest PHP version, 7.1.12, and still get this message. I know D9 likes PHP 7.5 or something, but how do I get that?
Should I simply upgrade PHP locally, independent of DevDesktop? Or is DevDesktop now old school, replaced by something better?


texts: Why Are Changes / Updates to User Account Fields Not Persisted (Lost on Page Refresh)

texts:
Drupal version 7.52.

Updating a user account page, e.g. changing their email or name, results in the page being reloaded with the changes persisted in the form, but when you refresh the page the changes are lost.

It's as if some validation errors are blocking the user update function but no feedback is being displayed.

Checked all logs and no errors reported.


texts:
I'd like to be able to create a topic on an existing forum, using the REST API exposed by the Services module. This is drupal7 and services 3.x .

via the REST interface, I can successfully:

query the index of forums  GET /rest/node?parameters\[type\]=forum
retrieve a single forum post.  GET /rest/node/8
update forum posts (via PUT)  PUT /rest/node/8   ...

I have not been able to create a forum post.
I tried many different variations of the JSON payload, and have not yet found the secret to success.

Example:

curl -i -X POST \
  -H Cookie:SESSe6a353351df0bfa8deadcafe=B0ZkiW3-U2x93yJU-deadbeef \
  -H X-CSRF-Token:PSCd5qIdddax0Mh5gfnOM872hdj893-eeeeffff \
  -H Accept:application/json \
  -H content-type:application/json \
  http://myserver/rest/node \
  -d '{
    "title": "This is a test post",
    "body": {
      "und": [{
        "value" : "This is a test post. Please ignore.",
        "summary": "test1",
        "format": "filtered_html"
      }]
    },
    "type": "forum",
    "language": "und",
    "status": "1",
    "forum_tid": "8"
  }'

The error looks like this

{
  "form_errors": {
    "taxonomy_forums][und":"An illegal choice has been detected. Please contact the site administrator."
  }
}

I have tried many variations of the payload, and always get the same error. I think the error means I need to pass different data. But I don't know which different data. Help?


texts: What are the potential security issues when importing an entity type?

texts:
I'm working on a module.

If the module is enabled, there would be an overview page showing the field structure of different content types. The visitor could then click a button to get a copy of the bundle's field structure (JSON encoded) and then use the code to create that content type on their site. Basically, like a feature except copy and paste rather than download.

What would potential security issues be? Is there any way to ensure that the hosting site (the site the content type is copied from) won't be able to do anything malicious?


texts: How to alter HTML generated for $messages?

texts: I'm building a theme from scratch using Bootstrap 3. I really don't like the HTML being generated for Drupal's $messages. I know I could change the look by using CSS. But I want more control than that, I want to generate different HTML based on type of message (warning, error, etc). I've custom classes & custom images & other custom elements to be used for these messages. I want complete control over the messages. What should I do?


texts: Webform: Use previous submission data to populate form fields on confirmation page

texts:
I have a webform using POST, no AJAX and Settings > Confirmation set to 'Message (reloads the current page/form and displays the confirmation message at the top of the page)'.
I'd like the form fields to retain the values entered prior to submission but they are being cleared at the moment.
I've tried setting a default value token ([webform_submission:values:my_field]) but this doesn't work.
I've also tried turning Autocomplete on, again no success.
What am I missing?


texts: How can I make a view to show all own comments?

texts:
I'm trying to show all comments the logged user did on a forum from the module advanced forum.
I've tried using views, adding a relationship with content:autor and filtering by user:current. But didn't work. Also I've tried contextual filter with the parameter comment :author id.
Anyone can help?

I'm using D7.


texts:
I am adding Arabic translations to an English website. For every article node, I need to individually translate each node.

Is there a way to add translations in one go?

The customer will update the content, but I need to create the initial translation of more than 500 nodes.


texts: Hooking into page specific instance of checkout flow form

texts:
I'm working on manipulating the buttons used for the checkout flow of using D8 Commerce 2.
I'm using MYMODULE_form_commerce_checkout_flow_multistep_default_alter but its changing both the form buttons on the order information page and the review page.
I want to have different buttons on these two pages.
Is there a way when using a hook to manipulate a form to set it so its page specific?


texts:
This is the content of the .info.yml file.

name: Endymion
description: Drupal 8 starter theme
type: theme
core: 8.x

libraries:
    - endymion/global-css

regions:
  header: Header
  primary_menu: 'Primary menu'
  breadcrumb: Breadcrumb
  content: Content
  sidebar_first: 'Sidebar first'
  footer_first: 'Footer first'

This is the content of the .libraries.yml file.

global-css:
    css:
        theme:
            css/css1.css: {}

I keep getting this error message:

  The website encountered an unexpected error. Please try again later.

How do I fix this error?

Additional point:

Get the same error message whether I'm running locally or on a remote server (siteground)


texts: Media module: how to generate a pdf link?

texts: I'm trying to use the media module to generate a link to a pdf that I uploaded using media module. The problem is that when I insert the pdf that is on my library and select the link format, it displays a missing image and does not generte my link. What should I do to make it generate the link to my pdf?


texts: Search API autocomplete: How to get Node ID in suggestions?

texts:
I am using https://www.drupal.org/project/search_api_autocomplete for autocomplete search results
is it possible to get Node ID with suggested results?
Thanks


texts: In a twig, how do I access different fields of a specific content type in a taxonomy term page

texts:
I have some taxonomy terms like Computer and Accessories, Games, Furniture etc. which I am able to access as /camera-and-accessories, /furniture and so on. These taxonomy terms are associated with my Product content type.

A taxonomy page is always displaying default Product title and Body fields. But I want to customize this page so that it displays additional fields like field_product_price, field_product_photo from my Product content type. I was hoping for something like {{ content.parent }} but I don't think such a thing does not exist (yet!)

Template suggestion by Twig debug

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'taxonomy_term' -->
<!-- FILE NAME SUGGESTIONS:
   * taxonomy-term--1.html.twig
   * taxonomy-term--category.html.twig
   x taxonomy-term.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/custom/ezone/templates/taxonomy-term.html.twig' -->

According to the above output I first overrode default taxonomy-term.html.twig with taxonomy-term--category.html.twig. In taxonomy-term--category.html.twig I did not put anything but just "Hello World!" to check whether this file is being hit. After rebuilding cache the page renders this static text but surprisingly along with that the actual content also got rendered on the page, which I don't know why.

I deleted taxonomy-term--category.html.twig and copied taxonomy-term.html.twig from stable theme to my theme's templates folder. Removed all entries in that file and again tried the same thing with a static text block. Same thing happened again!

Somebody please help with these.
1. How to access fields of a content type on a taxonomy term page
2. Why overridden templates shows taxonomy content when custom template has nothing written in it.

I am sorry if above questions looks stupid or childish. I am a newbie to Drupal.


texts:
I am interested in autosuggesting products based on the tags an article contains which is read by a user.
How can I accomplish this with Drupal/Drupal Commerce?
thanks


texts: How do I override the default sorting when filtering a view by Taxonomy terms?

texts:
My current settings …

In Drupal 6, I currently have a view that filters and sorts nodes by the following criteria:

The taxonomy term is very general, and nodes can either be assigned to "Referenzen" only, or any of its sub-nodes. This is done for the basic structuring of the site. Here, in this view though, I only want to "load all nodes with 'Referenzen' assigned", regardless of their sub-term.

The problem …

"Wichtig" ("important") is an integer value that defines the primary sort criteria for me. I do not care whether a reference is filed under "Media" or "Consulting", or any other sub-term.

However, the nodes are finally displayed like this:

Node 1   Important:  100   Taxonomy: Referenzen
Node 2   Important:    0   Taxonomy: Referenzen
Node 3   Important: -100   Taxonomy: Referenzen
Node 4   Important:  100   Taxonomy: Referenzen – Media
Node 5   Important:   80   Taxonomy: Referenzen – Media

As you can see, the "Important" factor comes second when sorting the nodes, and the taxonomy grouping comes first.

How can I change this behavior, so the following is achieved:

Node 1   Important:  100   Taxonomy: Referenzen
Node 4   Important:  100   Taxonomy: Referenzen – Media
Node 5   Important:   80   Taxonomy: Referenzen – Media
Node 2   Important:    0   Taxonomy: Referenzen
Node 3   Important: -100   Taxonomy: Referenzen

The executed query

SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node_data_field_image.field_image_fid AS node_data_field_image_field_image_fid, node_data_field_image.field_image_list AS node_data_field_image_field_image_list, node_data_field_image.field_image_data AS node_data_field_image_field_image_data, node.type AS node_type, node.vid AS node_vid, node_revisions.teaser AS node_revisions_teaser, node_revisions.format AS node_revisions_format, node_data_field_important.field_important_value AS node_data_field_important_field_important_value, node_data_field_date.field_date_value AS node_data_field_date_field_date_value
FROM node node
INNER JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN content_field_image node_data_field_image ON node.vid = node_data_field_image.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
LEFT JOIN content_field_important node_data_field_important ON node.vid = node_data_field_important.vid
LEFT JOIN content_type_story node_data_field_date ON node.vid = node_data_field_date.vid
WHERE (term_node.tid = 2) AND (node.language in ('***CURRENT_LANGUAGE***')) AND (node.status <> 0)
ORDER BY node_data_field_important_field_important_value DESC, node_data_field_date_field_date_value DESC

The exported view

… can be downloaded here:

  http://cl.ly/1c2c0X3f1Q2L3Y3x3l3w

MySQL Query Browser

… however tells me that those that have the "Wichtig" field not set have the value NULL and therefore are sorted last. All newly created nodes get "Wichtig" set as 0, however all old ones still have NULL.

So what can I do to make those with NULL have the value 0 instead and how can I prevent this for new articles in the future?


texts: Inject new variables in html.tpl.php based on current node content type

texts:
I would like to add custom classes and id attribute to html.tpl.php (body tag) based on current viewed content type.

I know i can do like:

 function mytheme_preprocess_html(&$variables) {
            $variables['classes_array'][] = 'myClass';
        }

but how to make it conditional like

           $node = $variables['node'];
        if ($node->type == 'lighters') {
//assign value to $variables['classes_array'] somehow
}

Also, how can i define new custom_array to inject variable based on content type to body tag ?
Im on Drupal 7.
Thanks!


texts: When to use different vocabularies vs. one big hierarchical vocabulary with parent terms

texts:
Context: I'm developing a website (a directory of things) with a content type "product" that relies on an extensive list with actually two levels: say "productname" and "productvariation". In real life this could be "fruits" or "beer" for the first level "productname" and then "strawberrys", "apples", "peaches" or "stout", "wheat" or "lager" for the second level "productvariation". There won't be a third level as all variations will go on that second level even if they are a subcategory of one variation. It's important that the content type can hold unlimited values of "productnames" (first level) and subsequently unlimited values of "variations" from the selected "productnames".

I want easy editing for the people who will maintain this site. I'm thinking conditional field architecture: User selects one ore more products (radiobuttons or checkboxes)and then the appropriate (select) lists of variations appear for further selecting.

Right now I'm thinking the first level as different vocabs but I don't know if this is the right way?

I haven't found a way to display the vocabs as a list (like a term reference field) so I'm doubting my draft. Is the above a misconception and i should use just one vocabulary?

Thanks in advance!


texts: Open link as modal form or normal form based on user role

texts:
I wish to have a link 'Post Ad':

For anonymous user: a modal login form will be displayed to request log in.

For logged in user: a normal ad posting form.

I managed to use the ctools for modal login form, but i have no idea how to get the normal form to display. (Exception happens when open the normal form, an ajax http error occurred.)

How to achieve this without create two links?

Thanks!


texts: Exposed view in field widget submits node form when filtering

texts:
I have defined my own field widget for node_reference fields. This contains a simple view that lets you select a node to reference. However, if i try to use exposed filters as a part of this widget it will try to submit the whole node form every time i press "Apply". Thus i can't use the exposed filters in views. How can i get around this?

I have ajax activated for the view and have tried different types of displays.

EDIT:
Just want to add that i am using Drupal 7 and the latest version of views!


texts:
I've set up a test environment for our live drupal site so that we can test PHP/Drupal core upgrades.ee
The test sites can't redirect to HTTPS as the self-signed certs won't work on a browser, so I can't access the sites, so access must be through HTTP.
However, the issue is it's always redirecting to https when accessing the http site, even though on our test server I've removed the redirects from the vhost file (httpd.conf) and the .htaccess file.
I've also checked our drupal config and there doesn't seem to be any redirect modules or settings that would force https.
Lastly, I checked the settings.php file, nothing relevant in there either.
What else is left to check?


texts:
I'm relearning views with D8 and am converting some old D6 views. I've created a view with "Grouping field" set in "Style options", but the SQL generated doesn't include any GROUP BY field.

The field in question is a date, which I am custom formatting as "Y" and have ticked "Use rendered output to group rows".

The SQL generated is:

SELECT node_field_data.langcode AS node_field_data_langcode, node_field_data.title AS node_field_data_title, node_field_data.nid AS nid, DATE_FORMAT(node__field_publication_date.field_publication_date_value, '%Y') AS node__field_publication_date_field_publication_date_value_ye
FROM
{node_field_data} node_field_data
INNER JOIN {node__library_type} node__library_type ON node_field_data.nid = node__library_type.entity_id AND (node__library_type.deleted = '0' AND node__library_type.langcode = node_field_data.langcode)
LEFT JOIN {node__field_publication_date} node__field_publication_date ON node_field_data.nid = node__field_publication_date.entity_id AND (node__field_publication_date.deleted = '0' AND node__field_publication_date.langcode = node_field_data.langcode)
WHERE (( (node__library_type.library_type_target_id = '1937') )AND(( (node_field_data.status = 1 OR (node_field_data.uid = 1 AND 1 <> 0 AND 1 = 1) OR 1 = 1) AND (node_field_data.type IN  ('library')) )))
ORDER BY node__field_publication_date_field_publication_date_value_ye DESC, node_field_data_title ASC

Is this because I'm using "Fields" mode to display?


texts: How to show image field's error message on the top of the form after uploading image

texts:
In my node form i am using image field with multiple value. When i upload an image, an error message is appearing on the top of that field but middle of the form, if i submit the form, error message is appearing on the top of the form.

I want to render the error message on the top of form not the top of that field while uploading the image.

Any help will be awesome.

Thanks.


texts: Views and CSS : how to exclude the exposed filters from CSS?

texts:
I'm using CSS to make a masonry effect in Views. And it works, but... The exposed filters and the pager get "caught" in the masonry effect instead of being on top (and bottom) of the results.

Question : how to set the CSS so that the exposed filters and the pager stay out of the results.

Thanks!

ps.: I know about Masonry views, but I prefer CSS.

The CSS:

In Views "Other" : CSS Class

.brick-user {
    margin: 1.5em 0;
    padding: 0;
    -moz-column-gap: 10px;
    -webkit-column-gap: 10px;
    column-gap: 3em;
    font-size: .85em;
}

Settins : Row class

.brique-user-item {
    display: inline-block;
    background: #fff;
    border: 1px solid lightgrey;
    padding: 15px;
    margin: 0 0 1.5em;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;

}


texts: D8 - show view in comments depending on user role

texts:
how i have to set up a view with Drupal 8 to show a field in the comments when the user_role is NOT "admin".

im not sure what kind of relationship and contextfilter i need to to this?

background: i want to show a label under the user_image of the comments
Thanks for help!


texts:
I need a food order system to embed in my drupal 7 website.
I added the screen shot of the design here:

I don't want a full eCommerce system.User can select items and the items will be listed in the order list.They can edit the no of items from remove items form the order list.After send an order the order will be stored in db and the site admin can view it on the admin part.From he can process it manually.There is no payment system for it and this is only to track the order and deliver it manually.

Can you please suggest me better way to accomplish it.

thanks in advance.


texts:
I want to do some debugging with a db_insert query. I tried to use the addTag() method, but I got an error:

$query = db_insert('nodes') ->addTag('my query');

PHP Fatal error:  Call to undefined method InsertQuery_mysql::addTag()

Is there a way I can tag this query or otherwise make it available to hook_query_alter?

Edit This query is not giving me the expected results, and I want to know why. To see why, I need to see the query with its values. Looking in the documentation for InsertQuery_mysql, it appears there's no getArguments() method.

Is there any way to see the values that are being inserted?


texts: Node content in panels vs. configuration in code

texts:
I am trying to keep most of the configuration in code (and separating content and configuration). When I have a panel that is supposed to contain a content from for example a node, I would like to be able to export that setup somehow so that I can be sure it would work also on the other page. So it shouldnt be a node id, not either node title (so from my point of view, this help doesnt qualify).

The way I did it is somewhat complicated, but allows me to keep all config in code while happily creating the content separately. I am posting a writeup my colleague did to convince me i am doing it too much complicated. Yet, I cant think of a better way.

Create taxonomy vocabulary with terms: top, middle, bottom.
Create custom node-type called panel content to which you assign terms from vocabulary from pt 1
Create a view that takes term from vocab from pt 1 as an argument.
Place this view inside frontpage panel and hardcode the argument depending on region.

Am I missing some point here? Would there be a better way to it?
Thanks.


texts: changing value of the form inside .module

texts:
I have a field in my newsletter, where user can enter his custom css.
That css is being applied for emails that are sent as newsletters.
Since I kinda want to create a default template, I'd rather import that CSS to my custom .module.
This is how form currently looks like (form that calls CSS):

$form['simplenews_template']['simplenews_template_style']["simplenews_template_css_$tid"] = array(
    '#type' => 'textarea',
    '#title' => t('CSS'),
    '#description' => t('Enter the CSS rules of the body.'),
    '#default_value' => _simplenews_template_get_css($tid),
  );

Is it possible that instead of _simplenews_template_get_css($tid) I put CSS code like body {background:red}; or at least call a file.css that will contain same css code inside and make all email outputs default and how would code look like ?

Thanks,
Michael


texts: Admin user can't manage fields on custom content type

texts:
When in logged in to my Drupal 7 install as the administrative user, I can't access the "Manage fields" or "Manage Display" for my custom content types.

I've tried all the following with no joy:

I've deactivated all my custom modules
I've given the admin user all permissions
I've flushed the cache, many, many times
Logged out and back in

I'm pretty sure I'm not using the hook_drupal_break hook anywhere!

I've got NO IDEA what I've done wrong. It used to work, but now I can't access it.


texts: Block displaying in 'content' region of admin theme?

texts:
The below implementation of hook_block_info renders a block in the 'content' region of my theme. Unfortunately, it also appears in the content region of the administrative theme. The documentation states:

  properties: (optional) Array of additional metadata to add to the
  block. Common properties include: administrative:

  Boolean that
  categorizes this block as usable in an administrative context. This
  might include blocks that help an administrator approve/deny comments,
  or view recently created user accounts.

/**
 * Implements hook_block_info().
 */
function mymodule_block_info() {
  $blocks['diary'] = array(
    'info' => t('Diary'),
    'properties' => array('administrative' => FALSE),
    'weight' => 1,
    'status' => TRUE,
    'region' => 'content',
  );
  return $blocks;
}

However, my block is still appearing in the 'content' region of the administrative theme?


texts: Will this php code (field_view_field) work if i put this inside body field of a node with php filter?

texts:
Will this work if i put this inside body field of a node with php filter?

<?php echo "
How are doing? Rate this site
" ?>
<?php print render(field_view_field('node', $node, 'field_fivestar_rating')); ?>

I tried in there but its displays an error.

Notice: Undefined variable: node in eval() (line 2 of C:\ssatempsite\modules\php\php.module(80) : eval()'d code).

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7562 of C:\ssatempsite\includes\common.inc).


texts: Change Form Single Select element to Multi Select for JS enabled users

texts:
I would like to have an exposed filter that shows single select by default, but for JS users is able to be altered to a multi-select.

The reason for this is that I want to apply the JQuery plugin Chosen onto my multi-select elements. However showing the pure multi-select element in the same block space on the page will be both unsightly and unwieldy for non-JS users, so I'd prefer they fell back to a single-select drop down menu.

I guess I can easily change a single select to a multi-select using JQuery, however is this going to prevent Drupal from accepting multiple values since the form element will only be expecting a single value for that single-select element?

Thank!


texts: I placed drush in MAMP folder outside of htdocs folder and downloaded drupal successfully but obviously to wrong folder. Where should drush be placed to have it work with drupal folder in htdocs folder?


texts:
I have create file config in a module

/custom
       /module_name
                   /config
                          /install
                                  /module_name.settings.yml

this is only read Installation.
Is there a way to reload it if it changes?


texts:
I am trying to join two tables on the same database, db2. I am trying to join tablename to tablename2 using the condition tablename.ItemID = tablename2.ItemID. While the values from tablename are selectable from a view, those from tablename2 aren't.
Do I need to specify in what database tablename2 is?
/**
* Implementation of hook_views_data
*/

function  mydatabase_views_views_data() {
  $data['tablename']['table']['group'] = t('Title name');
  $data['tablename']['table']['base'] = array(
    'field' => 'ItemID',
    'title' => t('db2'),
    'help' => t('Autoincremented ID field, to enable views integration'),
    'database' => 'db2',
    'weight' => -10,
  );

  $data['tablename']['table']['join'] = array(
    'deals_addon' => array(
      'left_field' => 'ItemID',
      'field' => 'ItemID',
    ),
  );

  $data['tablename']['ItemID'] = array(
    'title' => t('Item ID'),
    'help' => t('Item ID'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );

  $data['tablename']['ItemInfo'] = array(
    'title' => t('Item Info'),
    'help' => t('Item Info'),
    'relationship' => array(
      'base' => 'tablename2',
      'base_field' => 'ItemID',
      'handler' => 'views_handler_relationship',
      'label' => t('Label'),
      'title' => t('Title'),
      'help' => t('Help'),
    ),
  );
  return $data;
}


texts: How to mix charts views and table views on the same page?

texts:
I have a view with data displayed in a table format, and I have created another view formatted as a chart. For the view containing the chart, I used the views display style 'Charts', which was added as an additional views style by enabling the Charts module.

How can I display these two separated views on the same page?


texts: How do I check the content type of a file using hook_file_presave

texts:
I wrote a module to strip Exif data from uploaded file.

function modulename_file_presave(Drupal\file\FileInterface $file) {
if ($file->getMimeType() == 'image/jpeg') {
  $filepath = \Drupal::service('file_system')->realpath($file->getFileUri());
  $path = $file->getFileUri();
  $img = new Imagick($path);
  $img->stripImage();
  $img->writeImage($filepath);
  $img->clear;
}

it works to all files, but I want to restrict this module to work in only specific content type.
How can I get the content type in my module?
Thank you.


texts:
I'm new to Drupal and Omega theme. I made a subtheme of Omega 3.x HTML 5 using Omega tools.

I need to configure zones and regions in theme settings, Thus i went Home » Administration » Appearance » Settings (on my subtheme) > Zone and region configuration.

But those zones are not configurable. and I cannot click on those. Where did i do the mistake ?


texts: Uncaught TypeError: $(...).dialog is not a function: How do I include dialog?

texts:
I have added this code in my JavaScript file.

$( "#sponsor_dialog" ).dialog({
      autoOpen: false,
      height: 'auto',
      width:  520, resizable: false,
      show: {
        effect: "blind",
        duration: 1000
      },
      hide: {
        effect: "explode",
        duration: 1000
      }
    });

    $( "#sponsor_opener" ).click(function() {
      $( "#sponsor_dialog" ).dialog( "open" );
    });

I get the following error:

  Uncaught TypeError: $(...).dialog is not a function

In the module_name.libraries.yml I have added this.

sponsor_form:
  version: 1.x
  js:
    # For some reason, you need to put the js directly under 'js'.
    js/sponsor_form.js: {}
  dependencies:
   - core/jquery
   - core/drupal.ajax
   - core/drupal
   - core/drupalSettings
   - core/jquery.once

I am checking it when a user is logged out. Does this affect it in any way?
I have the same problem when I am logged in, though.


texts: Adding a webform in a webform confirmation

texts:
I've been given a requirement to allow for a webform to be inserted into another webform's confirmation page.

At first I tried this with a token I could insert into the confirmation message, the form appears fine, but of course, the new webform is inside of the "parent" webform, which strips out the form tag.

So now I have overriden a few of the webform and webform submission entities handlers, so I can write my own custom getCustomForm function, I can get the new form appearing, but the submit behaviours are weird.

I've tried many things including:

return Webform::load(
    $webform->getThirdPartySetting('my_module', 'webform')
)->getSubmissionForm();

and

$form['confirmation'] = [
    '#type' => 'webform',
    '#webform' => $webform->getThirdPartySetting('wwf_fields', 'webform'),
    '#source_entity' => $webform,
    '#message' => [
        '#type' => 'inline_template',
        '#template' => $webform->getSetting('confirmation_message')
    ]
];

Is there some combination of code I'm missing, or am I trying to bend the system a little too much?

Thanks!


texts: Unsupported serialization format on REST/Delete request

texts:
I'm getting the following error on my custom resource when sending the following DELETE request even though POST and GET are working fine

"A fatal error occurred: Serialization for the format  is not supported"

The request looks as follows:

If I'd change the method from DELETE to GET it would return status 200 with the intended - and for testing purposes identical - behaviour. The configuration in the Rest UI module looks as the following and the permissions for the requests (GET, POST and DELETE) are allowed for Guests:

Here is the code of my custom class:

/**
 * Provides a Demo Resource
 *
 * @RestResource(
 *   id = "test_resource",
 *   label = @Translation("Demo Resource"),
 *   uri_paths = {
 *      "canonical" = "/test_rest_api/test/{email}",
         "https://www.drupal.org/link-relations/create" = "/test_rest_api/test",
 *   }
 * )
 */
class TestResource extends ResourceBase {
  //Here are construct and create functions

  /**
   * Responds to entity GET requests.
   *
   * Does something
   *
   * @return \Drupal\rest\ResourceResponse
   */
   public function get($email) {
    $message = ["message" => $email];
    return new ResourceResponse($message);
   }

  /**
   * Responds to entity POST requests.
   *
   * Does something
   *
   * @param $data
   * @return \Drupal\rest\ResourceResponse
   */
  public function post(array $data = []) {
    $message = ["message" => $data["email"]];
    return new ResourceResponse($message);
  }

  /**
   * Responds to entity DELETE requests.
   *
   * Does something
   *
   * @return \Drupal\rest\ResourceResponse
   */
  public function delete($email) {
    $message = ["message" => $email];
    return new ResourceResponse($message);
  }
}

Has somebody an idea what I'm overlooking? I disabled/enabled the resource multiple and cleared the cache multiple times


texts: How to install drush extension / addon globally?

texts: I want to install drush-toolbox project globaly on my linux server box so all users can use it. How can I do it?


texts:
Even the searching I have done that looks like there may be a solution doesn't really seem to answer this.

I have a form with an input value.  When the user enters a value and clicks submit, I want to call a javascript routine and make that value available to it.

It seems simple enough, but I can't really find a good answer.


texts: how to add "access callback" function to a path defined by a view?

texts:
I'm using Drupal 7, Views 3, and hook_menu_alter

function MYMODULE_menu_alter(&$items){
  $items['client/place/%'] = array(
    'access callback' => 'custom_function',
  );
}

to override the view visibility (access), also flushing caches, but this doesn't seems to work, can somebody give some light about how to solve this, is this the right way to override path defined by a view ?

thanks in advance


texts: How to add captcha to "Printer, e-mail and PDF versions" email form

texts:
I am using the Printer, e-mail and PDF versions module to enable user to share pages on my d6 website.
Now I  have recently noticed that some robots make thousands of requests on this form a nd I need a captcha to prevent it. How can I do that?

Thanks


texts: Switching from Search API Database to Solr

texts:
i have a site which is already using Search API database and Facets search hosted on Acquia. The site main search (recipe search) is a  view with exposed filters to display search and similar content etc. And the site is in 2 languages ( EN and Arabic )

I need to implement spellcheck (did you mean) in the site and this module is only available for Solr.

I have no experience with Solr search. My question is how easy it will be to switch to Solr? Will i have to create different VIEW etc?

I have done a lot of theming, i am afraid of doing that all work again.

What is your expert opinion.

thanks :)


texts: What database table can be emptied in order to make database lighter?

texts: Are log files in drupal take a lot of space? I want to create a dump file but it's over 1000mb. What tables can be harmlessly emptied from the database directly or through drupal interface?


texts: How can I stop cron from deleting images I need

texts:
I have an image that is being deleted by the drupal 7 cron.

This is not good for us and I am trying to figure out how to prevent this.

As I am new to drupal I am not sure even where to begin but I am pretty sure we add the image via the core image module if that helps.

Please if anyone could help I would be most appreciative and sorry if this Q is too noob for here :)

The image is the only one in it's containing folder too.


texts: How to change default content type machine name in commerce kickstart?

texts:
I am using Drupal commerce kickstart 7 . I have installed perfecly . I am using demo store also. It have content types like hats, storage devices , etc,... I am using hats content type. So products show url like that hats/lloyd-l40s-40-full-hd-smart-led-television. But i want to show like products/lloyd-l40s-40-full-hd-smart-led-television.How to rename???

Thanks in advance


texts: 8 - Firefox loads JS before CSS, causing flash of unstyled content

texts:
My Drupal 8 site will load fine in Chrome and IE, because they both load my CSS before my JS when I look at the Network tab in the console. But when on Firefox, it will load the JS before the CSS. This causes some crazy flashes of styling as things are being loaded backwards to what should be expected to happen...

Has any one else run into a similar issue and found a workaround or know how I could get Firefox to load my CSS before my JS?


texts:
I wanted to add rel = "dofollow" to all internal links only like menu links, title links, user links etc. I managed to add rel = "nofollow" to comments and user posted contents. But I am not able to add rel = "dofollow" attribute to internal links.

Any suggestions how can I do this?

-- Thanks


texts: How to create a menu block which is created by the active trail

texts:
I'm trying to create a sidebar block which contains secondary and tertiary menu links for a page which is in the main menu. I would also like to ensure that all children pages also have this same menu block.

I have been looking into the Menu Block module, but I don't think it will work for my situation. It looks like that module shows a subset of a particular menu, but it doesn't change per page. I don't want to create multiple menu blocks, just use one and have it change dynamically.

Is there a solution in the community for this?


texts: How can I display all levels in Simple hierarchical select

texts:
I created select hierarchy ( taxonomy with 3 level), but in default it shows only one level , how can I display all 3 level in default page? : -Any- + -Any- + -Any-

I do not want it to automatically generate other fields.I want to display by default all the select input


texts:
I am new to Drupal 8 and Twig syntax. I am not able to understand how the clean_class filter works in region|clean_class. What is clean_class? I have added the following code in the page.html.twig file.
{%
  set classes = [
    'region',
    'region-' ~ region|clean_class,
  ]
%}

{{ dump(classes) }}

It prints this.
array (size=2)
  0 => string 'region' (length=6)
  1 => string 'region-' (length=7)


texts: how to grant a user to only access the performance area of the configuration screen drupal 7

texts:
I would like to give my content editors the ability to flush the website Drupal cache. I can't seem to give them this privilege without also giving them the privilege to do everything in the configuration tab. Can I only give them permissions to clear the cache? (Obviously this in addition to editing content) I am using Drupal 7.

Thanks!


texts: What API function do I use for redirecting to external URLs?

texts:
When writing a module, for redirecting to Drupal paths, one uses drupal_goto.

Is there some API function that I should use for redirecting to external pages?
Or is setting the Location with drupal_set_header the way to go?

PS I have to do some processing on the request; mod_rewrite/mod_alias on Apache-level or the Drupal Path redirect module, don't solve my problem.


texts:
I have checked all the similar questions on here, and the Drupal forums, but to no avail. I followed the Drupal documentation for creating a sub-theme, verbatim, but my new theme is not inheriting styles, at all.

Any idea what might be causing this issue, aside from what's already been suggested?

Below is our info.yml file:

name: MF Conference
type: theme
description: This is a mf sub theme of Conference Lite
core: '8.x'
# Defines the base theme
base theme: conference_lite
# Defines libraries group in which we can add css/js.
libraries:
  - mf_conference/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'

I've also tested with another base-theme and created a new sub-theme, again following the directions listed here: https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme

I know the CSS isn't inheriting because when I check the Inspector it doesn't have any information from the parent themes CSS files--only global.css


texts:
I've put together a simple FormAPI form including a file field.

The user should be able to upload a file and save the form, then come back later having the option to "undo" the upload - making the previously set file field blank again.

What is the best way to allow the user to clear the field?

Note: I'm looking for a way to empty / delete the myfile variable. The actual file does not necessarily need to be deleted from the filesystem, although this would be a bonus.

function mymodule_form($form, &$form_state) {

  $form['myfile'] = array(
    '#name' => 'files[myfile]',
    '#type' => 'file',
    '#title' => t('Select a file to upload'),
    '#field_prefix' => variable_get('myfile'),  //show the filename if saved previously
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save changes'),
  );

  $form['#validate'][] = 'mymodule_validate';
  $form['#submit'][] = 'system_settings_form_submit';
  $form['#theme'] = 'system_settings_form';

  return $form;
}

function mymodule_validate(&$form, &$form_state) {

  if ($tmp_file = file_save_upload('myfile')) {
    $destination = 'public://' . uniqid() . '_' . $tmp_file->filename;

    if ( $file = file_copy($tmp_file, $destination, FILE_EXISTS_RENAME) ) {
      $file->status = FILE_STATUS_PERMANENT;
      file_save($file);
      $form_state['values']['myfile'] = file_create_url($file->uri);
    } else {
      form_set_error('myfile', t("Failed to upload."));
    }
  }
}


texts: Sort views exposed filter in drupalgap alphabetically

texts:
Despite trying to make it work at all posible ways, i'm not able to order the select/options form from A to Z. it displays me by option "id" and what i want is to show my drupalgap form using hook_form_alter and display the order correctly. This is the last thing i tried until now. Thanks!!!

 $(document).on("pageload", "#informes", function() {
      console.log("hola");
        $("#edit-views-exposed-form-field-organismo-auditado-mobile-value").append($("#edit-views-exposed-form-field-organismo-auditado-mobile-value option").remove().sort(function(a, b) {
            var at = $(a).text(), bt = $(b).text();
            return (at > bt)?1:((at < bt)?-1:0);
        }));
      });


texts:
I need to save term lineage in Drupal 8, not only the deepest term. I know there are modules like Hierarchical select, Simple hierarchical select or Client-side hierarchical select but these are not for Drupal 8, or not solves "save term lineage" functionality.

I need to get my "nodes" visible on both child term and parent term pages too. I know, I can use the "Content: Has taxonomy term ID (with depth)" (under contextual filters) functionality in "views", but it slows the database queries very much. Or maybe I'm doing something wrong.

Is there some reasonable solution?

Thank you!

EDIT: The hierarchy is very simple. Only two-tiered: Country / City.

Can someone help me to re-save my nodes with "lineage" structure? For example, using the TermStorage functions listed below?


texts: How do I programmatically change a system message?

texts:
Hey there I want to change or hide a drupal message from the CommentForm class.

In my entity_insert() hook I set a new message.

I have an idea of how to do it but still no idea of where to do it.

idea:

  whether unset the $_SESSION['messages'] and set it with my message
  after I unset it.

  Or

  drupal_get_message($type, TRUE).

problem my message will be set before the one I want to exclude. So if I unset the message array my message will be gone, too.

So my Question is where to put those in myModule?

I also tried to hook in the specific form and add a submit handler but that doesn't work.

/**
 * Implements hook_form_FORM_ID_alter().
 */
function my_module_form_comment_form_alter(&$form, FormStateInterface $form_state) {
  $form['actions']['submit']['#submit'][]  = 'my_module_comment_form_submit';
}

/**
 * Submit handler.
 */
function my_module_comment_form_submit(&$form, FormStateInterface $form_state) {
  $message = $_SESSION['messages'];
}

Ok I've figured it out.
But that solution is pretty ugly in my opinion.

I do this in a hook_preprocess.

/**
 * Implements hook_preprocess_HOOK().
 */
function my_module_preprocess_node(&$variables) {
  $user = Drupal::currentUser();
  $entity_id = $variables['attributes']['data-history-node-id'];
  $entity_type = $variables['elements']['comment']['#entity_type'];
  $bundle = $variables['elements']['comment']['#bundle'];
  $comment_type = FieldConfig::load($entity_type . '.' . $bundle . '.comment');
  $maxCommmentUser = $comment_type->getThirdPartySetting('my_module', 'edit-limit-per-user', FALSE) + 1;
  $limitUser = $comment_type->getThirdPartySetting('my_module', 'edit-limit-per-user', FALSE);
  $currentCommentUser = my_module_get_user($entity_id);
  $maxCommentNode = $comment_type->getThirdPartySetting('my_module', 'edit-limit-per-node', FALSE) + 1;
  $limitNode = $comment_type->getThirdPartySetting('my_module', 'edit-limit-per-node', FALSE);
  $currentCommentNode = my_module_get_node($entity_id);
  if ($maxCommentNode) {
    if ($maxCommentNode <= $currentCommentNode && !$user->hasPermission('bypass comment limit')) {
      drupal_get_messages('status', TRUE);
      drupal_set_message(t('The Node you want to comment has reached its maximum of @maxcommentnode comments', ['@maxcommentnode' => $limitNode]));

    }
  }
  if ($maxCommmentUser) {
    if ($maxCommmentUser <= $currentCommentUser && !$user->hasPermission('bypass comment limit')) {
      drupal_get_messages('status', TRUE);
      drupal_set_message(t('You have commented @maxcomment times, please edit or delete some of your older comments', ['@maxcomment' => $limitUser]));
    }
  }
}


texts:
Drupal 7

Users can't edit their own profile pictures. The admin can edit them, but the regular user cannot edit his own. A user can see their own picture, but if they click the Edit tab it is not listed as a field that can be edited.

In /admin/config/people/accounts/fields I can see "picture", but there are no links to edit.

In /admin/config/people/accounts pictures can be enabled, but I see no relevant settings.

On /admin/people/permissions I see no relevant permissions.

Is there something obvious we are missing to enable users to edit their own profile pictures?

Edit: Screenshots below (with some data blanked out)

Viewing profile (the ghost guy image is the actual profile pic, just sample data):

Editing profile (no user picture field here):


texts:
I have installed CkEditor for drupal. But it is showing it for comment form also.
I don't want it to be shown. I dont want the user to have an option to select either.
I just want them to have plain text. How can I do that?


texts:
I've got a CSV where every row contains details about a node and then a URL to a file.

Each of the nodes rows has an id number associated representing each specific node.

So eg:

id, node name, file url
1, farfitnugen, /documents/foo.pdf
1, farfitnugen, /documents/bar.pdf
2, farfitnugen, /documents/2foo.pdf
2, farfitnugen, /documents/2bar.pdf

Using the example above, I've got the migration working such that it creates one record for each node, and downloads and links the appropriate file, but it does not cycle all the entries.

I'm currently mapping by the id, can anyone provide a suggestion of how to get Migrate to import all the documents per node?


texts: How to get page visit count from access log

texts:
I need to display the list of pages(nodes & terms) from access log. I enabled drupal core statistics module.

The view result should include

Page title.
Total number of distinct pages($view->total_rows).
Total views result($view->result).
Individual visit count of pages ().

I created a view and a template. I am getting points #1,#2 & #3 in my view. But #4 is missing.

I checked access log table in DB, but didn't found the column for page view count. How can get the missing point in my view?


texts: dpm() in hook_init shows twice on the page

texts:
In my custom module, I use a hook_init() with a dpm-function.

function mymodule_init() {
    dpm('check');
}

but for some reason, my page shows 2 times 'check' on the page... Is this default Drupal behavior? And if so, what are the reason for this behavior?


texts: How to allow multiple values in a single value textfield

texts:
I am using views_conditional module for Drupal 7 and would like to use a comma separated array (i think this is called an array?) of values in the "This value" textfield.
For example, I would like to add a views conditional field that checks for:
If this field...
[type] == Content Type
Is...
Contains
This value...
Apples, (or) Oranges, (or) Bananas
As it is right now, (unless I am missing something) I would need to add 3 separate conditional field. One for each content type (apples, oranges, and bananas) though they are all executing the same function.
(I think) The current definition for the value field is:
$form['equalto'] = array(
  '#type' => 'textfield',
  '#title' => t('This value'),
  '#description' => t('Input a value to compare the field against.  Replacement variables may be used'),
  '#default_value' => $this->options['equalto'],
);

I also think the logic for the "Is..." operator in this use case would technically need to be something like "Contains Any".
(I think) The "Contains" function is defined here:
      // Contains
  case 7:
    if (mb_stripos($r, $equalto) !== FALSE) {
      return $then;
    }
    else {
      return $or;
    }
    break;

Is there a way to simply write a couple of hooks to alter the form, or would i need a full blown module patch?
Any help or pointers would be greatly appreciated! I am pretty new to backend code. I also posted a support request at Drupal.org


texts: Rules module not enabling via Drush in drupal 7

texts:
this may be a simple one however while downloading Rules through drush and getting the following error.

root@li:/var/www/drupal7/sites/default# drush en rules*

No release history was found for the requested project (i18n_string).[warning]
Module rules_i18n cannot be enabled because it depends on the        [error]
following modules which could not be found: i18n_string

I also tried doing drush dl il8n_rules but to no use.

What is wrong here?


texts: Service to browse all contrib modules on drupal.org

texts: http://simplytest.me/ allows you to search all existing modules. I'm trying to implement a widget with the same functionality, but I'm stuck on how to browse all the projects on drupal.org... Can someone point me in the right direction? I found the module "project_browser", but can't seem to figure out how they accomplish it...


texts: View seems to be recursively calling parts of itself, leads to nesting level issue or memory issue

texts:
I have a view that is using view content panes, and it is generating the following error:

I've got a view that looks like this:

When I show the same map settings as a block, I don't see any issues, but when I try to do the same thing with a content pane, I get this crazy memory issue, or if I'm using xdebug, this Fatal error: Maximum function nesting level of '100' reached, aborting!issue.

What could be going on? How do I fix this?


texts: Change the page to which users are redirected after saving a comment

texts:
I am using Drupal 8.0.0, and I created a tab page for my custom node type (equipped with a field comment) to display just comments, so that comments are not displayed on the node (e.g. node/1) but on tab page (e.g. node/1/comments).

When I add a new comment and click the Save button, the user is redirected to the node (e.g. node/1#comment-16), but I would like to redirect users on the tab page I created (e.g. node/1/comments#comment-16, node/1/comments).

How can I achieve this?


texts:
I have a category mysite/news (the page created by the Views) and when I turn to the next page of this category - mysite/news?page=1, some text and image should not be displayed.

This code does not work

{% if url == 'mysite/news' %}
some text
{% endif %}


texts:
When I going to Disable Twig template cache , Fatal error . i.e

  The website encountered an unexpected error. Please try again later.
  Error: Unsupported operand types in
  Drupal\Core\Template\TwigEnvironment->__construct() (line 69 of
  core\lib\Drupal\Core\Template\TwigEnvironment.php).

I followed below steps :

1.Copy and rename the file from sites/example.settings.local.php to  sites/default/settings.local.php
2.Open settings.php file in sites/default and uncomment these lines:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}

3.Uncomment these lines in settings.local.php

$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Open development.services.yml in the sites folder and add the following code

 parameters:
twig.config:
debug: true
auto_reload: true
cache: false
Rebuild the cache and your good to go

My development.services.yml code :

parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
  debug: true
  auto_reload: true
  cache: false
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory


texts: Use Rules to give users a discount on their order after a few days (Commerce)

texts:
I want to create a series of rules that will discount user's carts in specific time intervals after their cart has been created. I can think of two way to do this. I realize that I will most likely need the rules_scheduler module as well. This site is built using Commerce.

My first idea was to create discount codes for each discount level (5OFF for 5% off, 10OFF for 10% off, etc.) that will only be enabled for that specific user during each respective timeframe. This would require these codes to be both enabled and disabled in order to transition properly. However, from what I currently understand, these discount codes are global. So this method would not work.
My second idea will still read the order created date. Two days after that, the rule will multiply their oder by .95. After five days that amount will change to .9. continuing as necessary.

Essentially:
1) User creates an account and adds products to his cart.
2) After 2 days pass, they will be given 5% off of this order.
3) After 5 days pass, they will be given 10% off of this order.
and so on.

My question is has anybody has tackled this issue before? I would like to receive some insight or advice on how to best accomplish this type of functionality . So far, I have been unsuccessful in figuring out how to make an order creation be the event to react on for this/these rules. I also have not used rules scheduler yet, but I do not foresee that being too difficult to configure. Thanks!


texts: Submitting a form with only a text field

texts: I may be missing something obvious, but it appears my form's submit function isn't being run by simply submitting text into my textfield (via. enter).  Do I need to add the submit button to get this behavior?  Is there a workaround so I don't have to?


texts: How to display view results by a value in a common field of page node

texts:
I have a node page, and I have a view of nodes on this node page.  The main node and the node results share a taxonomy field.

I need to only display results that share the same values as the parent node.  I know I need to do this with contextual filters somehow, but I can't seem to get the filter set.


texts: Overwrite jquery.ui.slider.min.css generated by jQuery Update module

texts:
The jQuery Update module generates a css file jquery.ui.slider.min.css for my website. I need to overwrite the jquery.ui.slider.min.css for this slider field. I don't want to loose my changes when we update the jQuery Update module.

What is the best way to add jquery.ui.slider.min.css into my theme?


texts: What is the most robust way to assert for a validation error?

texts: I want to test the validation function in my custom module, and so I've written a simpletest that inputs an illegal value in a field and then attempts to save the node. Currently I'm using assertText() to find the string contained in the validation failure message on the page, but if someone changes the wording of the failure message in the future, this could break. Is there a more robust way to check that a field, or even a node save generally, failed validation?


texts: How can I create a simple non-CRUD resource action with Drupal 7 / Services 3?

texts:
The resource "username" appears but my action does not appear in the list in services admin. Response to a POST is HTTP/1.1 404 Not found: Could not find resource username.

I replaced my module name with "module" here:

function module_services_resources() {
  return array(
    'username' => array(
      'check' => array(
        'help' => 'Checks username for uniqueness',
//       'file' => array('file' => 'inc', 'module' => 'noteresource'),
       'callback' => '_module_username_check',
       'access callback' => '_module_resource_access',
        'access arguments' => array('view'),
        'access arguments append' => TRUE,
        'args' => array(
          array(
            'name' => 'username',
            'type' => 'string',
            'description' => 'The username to check',
            'source' => 'data',
            'optional' => FALSE,
          ),
        ),
      )
    )
  );
}

function _module_resource_access($op, $args) {
  return TRUE;
}

function _module_username_check($data) {

  $username = $data->username;

  $user = db_fetch_object(db_query("SELECT uid FROM users WHERE name=':username'", array(":username" => $username)));

  return $user;
}


texts: Create / Edit node and continue editing on same page after submit

texts:
D7 has module "Save & Edit".

There are any solutions for D8?


texts: Can you disable drush pm-update for a site?

texts:
Can you disable drush pm-update for a particular site in drushrc.php?

I have a server which houses the DEV and LIVE versions of the site.  Work is done directly on the DEV site.  Changes to the LIVE site are deployed via git pull from a shared remote on the same filesystem.

In an effort to prevent Doing Something Stupid™, and running a pm-update and pm-updatecode on the LIVE site, I would like to disable these commands for that site.

The $command_specific[] syntax allows you to specify persistent options for commands (like --no-core), but I would like to fully disable pm-update and pm-updatecode for this particular site.

Is this possible?


texts: Enforcing minimum number of characters for #autocomplete_path

texts:
I have a form that is using #autocomplete_path on a textfield.  In general it works fine.

Is there a way to have the autocomplete callback not fire until a minimum number of characters have been entered?

Is the only real option to override Drupal.ACDB.prototype.search with my own version, or is there a clean way to do this?

I am not interested in server side solutions to limit the result set; I am trying to decrease server load here and really need a client-side solution to prevent useless requests from ever being generated.


texts: How to add order number to multivalue fields classes?

texts:
A node with a multivalue image field looks something like this in html (the part which displays images):

....

I would like it to look like this:

....

One way is to write a node--contenttype.tpl.php and inside, instead of print render($content); make a big loop which will render the fields one by one, adding the necessary class with number to images.

Is there a simpler way to achieve this?


texts: Hook name in module doesn't seem to work

texts:
I've been at this for days, but I finally think I maybe kinda sorta found part of the problem, maybe...but I don't know how to fix it.
I'm working on a Drupal site with the CiviCRM module running.  I have a form on which I'd like to alter the data before saving it to the database.  As a result, I've been struggling with getting ANY of the available CiviCRM hooks to fire.
I installed the civicrm_developer module, which is sort of a complement to Devel, in that it is used to help see into objects and other variables.  Looking in the module's .module file, you see all of the CiviCRM hook functions, which are being used in the module to dpm() whatever variables were passed to them.
function civicrm_developer_civicrm_buildForm($formName, &$form){
  drupal_set_message("hook_civicrm_buildForm called: formName is $formName");
  dpm($form);
  dpm($formName);
}

There are no includes or anything else, just hooks and printing  variables, for each and every hook available in CiviCRM. The civicrm_developer module indeed works as intended. On the specific page I'm working with, there is a CiviCRM form and this module prints a populated Krumo above that form, as would be expected when dpm()-ing a variable in Drupal.
However, attempts at making a custom module which uses one or two of those same hooks, can never seem to get to that same data.  I've gone far as copying the code from that module (just one .module and .info file) to my custom module and changed the hook nomenclature from "civicrm_developer" to, let's say, "mymodule".
So, my module, which is practically an exact copy of that module, with the exception of the hook name, will not generate a Krumo above the form as the civicrm_developer module did when it was enabled. Yes, I've made sure that my module was enabled.
For example, this is the same function from earlier as written in my custom module.
function mymodule_buildForm($formName, &$form){
  drupal_set_message("mymodule_buildForm called: formName is $formName");
  dpm($form);
  dpm($formName);
}

It might also be worth mentioning that the mymodule name in use is unique to that module. It doesn't match the theme name or anything else that would cause a name collision, at least that I know of.
I can't figure out why the same hooks work in a module but not the other.  It just doesn't make any sense.


texts:
When creating one of the menu items I accidentally left the "Use tokens in title and in path." option checked while setting the path to .

It is now causing the following error on every page:

Notice: Undefined index: path in menu_token_translated_menu_link_alter() (line 160 of /home/mysite/public_html/sites/all/modules/menu_token/menu_token.module).

I am now trying to delete this menu item and create a new one in its place but I am unable to delte it. It times out. I was able to disable but it is not preventing the error message from displaying. How would I go about deleting this menu item?


texts:
I created a form using the code from Examples module, which you can find in '.../examples/ajax_example/autotextfields'. In the example when you select both 'Ask me my first name' and ' Ask me my last name ' very fast, it is generating only one textfield. To achieve this bug, in this example you need to select very very fast, but I have bigger form and on select it is loading longer... This is very confusing for users and big problem for my project. Have you suggestions how to fix that? The bug is the same as in example module, so here is the code from example:

/**
 * Show/hide textfields based on AJAX-enabled checkbox clicks.
 */
function ajax_example_autotextfields($form, &$form_state) {

  $form['ask_first_name'] = array(
    '#type' => 'checkbox',
    '#title' => t('Ask me my first name'),
    '#ajax' => array(
      'callback' => 'ajax_example_autotextfields_callback',
      'wrapper' => 'textfields',
      'effect' => 'fade',
    )
  );
  $form['ask_last_name'] = array(
   '#type' => 'checkbox',
   '#title' => t('Ask me my last name'),
    '#ajax' => array(
      'callback' => 'ajax_example_autotextfields_callback',
      'wrapper' => 'textfields',
      'effect' => 'fade',
    ),
  );

  $form['textfields'] = array(
    '#title' => t("Generated text fields for first and last name"),
    '#prefix' => '
',
    '#suffix' => '
',
    '#type' => 'fieldset',
    '#description' => t('This is where we put automatically generated textfields'),
  );

  // Since checkboxes return TRUE or FALSE, we have to check that
  // $form_state has been filled as well as what it contains.
  if (!empty($form_state['values']['ask_first_name']) && $form_state['values']['ask_first_name']) {
    $form['textfields']['first_name'] = array(
      '#type' => 'textfield',
      '#title' => t('First Name'),
      '#required' => true,
    );
  }
  if (!empty($form_state['values']['ask_last_name']) && $form_state['values']['ask_last_name']) {
    $form['textfields']['last_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Last Name'),
    );
  }

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Click Me'),
  );

  return $form;
}

/**
 * Selects the piece of the form we want to use as replacement text and returns
 * it as a form (renderable array).
 *
 * @return renderable array (the textfields element)
 */
function ajax_example_autotextfields_callback($form, $form_state) {
  return $form['textfields'];

}


texts: I've made a drupal site using acquia Dev desktop 7.16.16 and i would like to know where the index.HTML or index.php file is stored? I found an index.php file at /Sites/acquia-drupal/ directory but it seems to need a root to work.


texts: Inline entity form complex widget not saving child entities

texts:
I'm using inline entity form on a node edit form. The target is a custom entity.

There are two possible form widgets to use: Simple or Complex.

With Simple (example) the child entity fields are just embedded in the parent form. It's not possible to collapse the child fields, nor is it possible to delete child entities, but it does save the child entities upon submitting the entire node edit form.

With Complex (example) the child entities fields are collapsible and the child entities can be deleted. However the child entity is only saved if the section of the form is not collapsed when the node edit form is submitted. Is this a bug?

I've discovered that using hook_inline_entity_form_entity_form_alter I can add a callback to the $form['#entity_builders'] array that is called when the child entity sub form is collapsed (and is meant to be saved).

In this callback I've added some super generic code to just save the child entity.

E.g.

function save_ief_child_entity($entity_type, $entity, $entity_form, $form_state) {

  $delta = $entity_form['#ief_row_delta'];
  $field_name = $entity_form['#parents'][0];
  $values = $form_state->getValue($field_name);

  // The location of the entity values changes depending on if it's a new save
  // or an update.
  if(isset($values['form']['inline_entity_form']['entities'][$delta]['form'])) {
    $values = $values['form']['inline_entity_form']['entities'][$delta]['form'];
  }
  else {
    $values =& $values['form']['inline_entity_form'];
  }

  if(empty($values)) {
    return;
  }

  // Loop form values to update entity
  foreach($values as $key => $value) {

    // Images are in the wrong format for some reason - fix it.
    foreach($value as &$part) {
      if(is_array($part) && isset($part['fids'])) {
        $part['target_id'] = $part['fids'][0];
      }
    }

    $entity->{$key} = $value;

  }

  $entity->save();

  // IEF takes care of creating the relationship between parent and child when the main form is submitted
}

Why do I have to do this / why doesn't IEF do this itself internally?


texts: Can I use a universal no-results display for Views?

texts:
In Drupal 7, is there a way to set a default, universal No results message for Views? Which of these following options should work?

Should I use a Rendered Entity? If so can I create a node (say, called 'no-results')? Is the Entity Id field, the URL of the entity?


texts: What is the proper file structure of a module that only contains sub-modules?

texts:
I have put together a module package that has 3 sub-modules. They must be contained in a single folder to be distributed and used by other devs. Are there drupal best practices for how a module's files structure should be if it contains just multiple modules?

e.g.

name_of_module/modules/module1/module1.info
name_of_module/modules/module2/module2.info
name_of_module/modules/module3/module3.info

or

name_of_module/module1/module1.info
name_of_module/module2/module2.info
name_of_module/module3/module3.info

or?


texts: Are there any pitfalls pointing config sync to profile's config/install?

texts:
Is this good practice? I have pointed my config sync to:

$config_directories['sync'] = 'profiles/PROFILENAME/config/install';

Experiments with drush cex have worked, allowing a cycle of UI changes, config export, and re-installation with the new changes.

We will not be going live with D8 for a while, so the team's plan is to use this method to gain familiarity with the config system and other parts of D8 using this simple method.


texts: Do I have to move contributed modules to "sites/all/modules" for upgrading?

texts:
In Drupal 6, I have placed my contributed modules inside the modules directory in the Drupal root directory (not in sites/all/modules). I need to upgrade my site to Drupal 7.

Do I have to move the contributed modules inside sites/all/modules before upgrading to Drupal 7?


texts: In Drupal 7 Commerce 1.x - is there a way to include the price into the dropdown product select box?

texts:
Currently the price is outside of the select box on product display's. Is there a way to include the price in the select box itself?

Example:

$5 - Basic Repair - Scratched Disc Recovery

instead of whats below.


texts: How to load content on different domain with jquery .load()

texts:
using this code in the drupal block:

<script type="text/javascript">
$('#block-block-16').load('http://nashmir.kz');
</script>

but it won't load content from domain nashmir.kz. With local files it works well. Can somebody throw me a working example on how to load content from another domain?


texts: I have a form that I created using webform. I have it styled like I want on the client side but whenever I view the submissions or edit the submissions I would like to style that portion as well on the admin side but cannot find a way to style these. Can some provide some help regarding how to handle this?


texts: Will Migrating Content Between Sites Preserve CKEditor Styles?

texts: I have been entering content on my dev site using CKEditor, but now I'm worried that moving to the live site will erase all the styling I have done to these articles. Maybe that is a dumb question, because I have not found anything addressing this topic online. If I have the CKEditor module installed on the live site, when I transfer my content there, will all their fonts/colors/styling/etc be preserved? Thanks in advance


texts:
I've put the following code above print render($content['comments']); in comment-wrapper.tpl.php of our theme to add question or answer class to every comment:

    foreach($content['comments'] as &$c) {
      if(is_array($c) && array_key_exists('#entity_type', $c) && $c['#entity_type'] == 'comment') {
        $uid = $c['comment_body']['#object']->uid;
        $c['#attributes']['class'][] = $uid == 1 ? 'answer' : 'question';
      }
    }

The generated HTML however has no question or answer classes. Please help me to correct the error.


texts: How do I include coffeescript and sass compilation steps into managing Aegir platforms?

texts:
By providing a drush make file, Aegir will create a new platfrom but sites cannot be created or migrated to it until coffeescript and sass files have been compiled.
Generated javascript and css are not suited to being kept under version control as they cause unnecessary conflicts etc.

How to augment Aegir to include these extra steps?


texts: Locating a specific position on the page

texts: I want to provide a clickable link on drupal such that it easily locates the position of the content in a page. e.g http://asblab.mie.utoronto.ca/people , I want to have a link , that automatically scrolls this page to locate "Past lab member" without requiring me to create a new node. Thank you in advance.


texts:
I have a Content Type called locations. I need to be able to assign these to Drupal users. Some users will have multiple locations.

Is there a module that will let me do this, or what are some suggestions you all might have?


texts: Rule to change ubercart role expiration when role is granted

texts:
I need to 'standardize' the expiration date of a ubercart role as soon as the role is granted. I think I understand what the events and conditions should be. I can't figure out how to create the action, though.

In pseudo-code, I want to set expiration_date = 10th day of following month. Mathematically, that's easy enough. I assume the action will be to 'Set a data value'.

I use the selector to get to expiration:expiration. I get an error message that "The selected data property doesn't support writing." Is there any way to make it writable?


texts:
Is there a way to hide a piece of content in a node if the current user is not friends with the author?

Basically I want to hide a piece of content or flag if the current user is not friends with the author. I've used Flag Friend module for the friends system.


texts: How do you join a custom table to a node from a field with hook_views_data()

texts:
I have a custom table that contains (for simplicity) two fields:

id
client_id

On my node content type, I have an integer type field called: field_dashboard_id.  All my nodes have the field_dashboard_id set to ids from the custom table.  I have a content view that I would like to also display the client id from the custom table. (FYI I am able to create a view if I use Dashboard Entries instead of Content but I want to use Content and join to Dashboard Entries)

I tried the following code but when I try to add a relationship, I am not seeing my custom table in Views.

/**
 * Implements hook_views_data().
 */
function mydashboard_views_data() {
  $data = [];

  $data['mydashboard_site']['table']['group'] = t('Dashboard');

  $data['mydashboard_site']['table']['base'] = [
    'field' => 'id',
    'title' => t('Dashboard entries'),
    'help' => t('Contains a list of dashboard entries.'),
  ];

  $data['mydashboard_site']['table']['join'] = array(
    'node' => array(
      'left_table' => 'node__field_dashboard_id',
      'left_field' => 'entity_id',
      'field' => 'id',
    ),
  );

  $data['mydashboard_site']['id'] = [
    'title' => t('ID'),
    'help' => t('Unique Site ID.'),
    'field' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'argument' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
    'relationship' => [
      'base' => 'node', // The name of the table to join with.
      'base field' => 'field_dashboard_id', // The name of the field on the joined table.
      // 'field' => 'nid' -- see hook_views_data_alter(); not needed here.
      'handler' => 'views_handler_relationship',
      'label' => t('Default label for the relationship'),
      'title' => t('Title shown when adding the relationship'),
      'help' => t('More information on this relationship'),
      'extra' => [
        [
          'field'    => 'field_dashboard_id',
          'value'    => 'value',
          'operator' => '=',
          'numeric'  => true,
        ],
      ],
    ],
  ];

  $data['mydashboard_site']['client_id'] = [
    'title' => t('Client ID'),
    'help' => t('The client id'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'argument' => [
      'id' => 'string',
    ],
  ];

  return $data;
}

Update

Also tried the following:

$data['mydashboard_site']['table']['join'] = [
  'node__field_dashboard_id' => [
    'left_field' => 'field_dashboard_id_value',
    'field' => 'id',
  ],
];

'relationship' => [
  'base' => 'node__field_dashboard_id', // The name of the table to join with.
  'base field' => 'entity_id', // The name of the field on the joined table.
   // ID of relationship handler plugin to use.
  'id' => 'standard',
   // Default label for relationship in the UI.
  'label' => t('Example node'),
],


texts: Date field and Jquery UI date picker - start date - end date

texts:
I'm not sure if this could be considered an issue, but I cannot find anywhere relevant in forum to pose the question.

I am trying to understand how webforms works with Jquery UI and date picker. My objective is to be able to manipulate what happens with the Jquery UI date picker element. Although things are working in the interface, when I submit the form the data is not being saved.

If anybody could point out where I am going wrong and point me in the right direction I would be very grateful.

here is my problem :

I have two date fields. and arrival date and a departure date. I want to be able to refresh/rewrite value of departure date based on what has been selected for the arrival date.

I have added the following code to a js file which is called by the page :

(function ($) {
  Drupal.behaviors.localeDatepicker = {
    attach: function (context, settings) {
      jQuery("#edit-submitted-arrivee").datepicker({
        onSelect: function (date) {
          var date2 = jQuery('#edit-submitted-arrivee').datepicker('getDate');
          date2.setDate(date2.getDate() + 2);
          jQuery('#edit-submitted-depart').datepicker('setDate', date2);
          //sets minDate to edit-submitted-arrivee date  1
          jQuery('#edit-submitted-depart').datepicker('option', 'minDate', date2);
        }
      });
      jQuery("#edit-submitted-depart").datepicker({
        onClose: function () {
          var date2 = jQuery('#edit-submitted-arrivee').datepicker('getDate');
          console.log(edit-submitted-arrivee);
          var date1 = jQuery('#edit-submitted-depart').datepicker('getDate');
          if (date1 <= date2) {
            var minDate = jQuery('#edit-submitted-depart').datepicker('option', 'minDate');
            jQuery('#edit-submitted-depart').datepicker('setDate', minDate);
          }
        }
      });
    }
  };
}(jQuery));

As I said everything works ok in the browser for the user... but when the form is submitted the values for the dates are not passed to the submissions table.... is there something wrong with the way I call Drupal.behaviors.localeDatepicker or is there something with onSelect: function (date) I should be noticing?

thanks in advance for any suggestions.


texts:
I have created the following List field type of checkboxes to allow users to select their own content's privacy settings when creating a node called RideShares:

1|me only
2|any registered site member
3|users on the same flights as me
4|users arriving at the same airport during the same week as me.
5|public

I can use the exposed filter to manually select any matching nodes, but do not know how to automatically filter the queried RideShares to the current user's data in other bundle/content types. For example, whether the current user has entered a Flight into where the destination airpor catches one of the existing RideShares.

It seems this cannot be done with context filters in Views.


texts: Search API view doesn't display placed block

texts:
Using Drupal 8.6 here and going mad with this:

I installed Search API module that has Database Search and Database Search Default included.

I can't install Database Search Default for the following reason "Content type article not found. Database Search Defaults module could not be installed.

Content type page not found. Database Search Defaults module could not be installed.".

I don't know what content type article or content type page the message is referring to

Another strange thing that i noticed is that i am not able to preview fulltext with "expose filter to visitiors" on my view
and also i can't see the block in my page tho i place it on block layout.

Can someone please tell me how do i display the block in the block layout?

Thank you for reading,


texts: Login form and registration form not properly displayed

texts:
I am using D7, with the help of Modal form module i am trying to display the login and registration form in a overlay effect. When the user visits /user/register or /user/login i get the overlay but not the form. I have attached a snapshot for further reference.

Where am i wrong in displaying this form?

Thanks.


texts: Disable modules when browsing mobile site

texts:
I have a site that also serves its content to mobile devices. As these sites(desktop/mobile) uses same code. I have a problem in performance since the modules being used in desktop site is also loaded in mobile site even if I'm not using it. Is there a way to excludes those modules(custom/contrib) without hacking each modules? Any good idea in this kind of situation?

Hi Patrick...something like this code I created so far...but I'm not sure if this is feasible.

function array_search_regex($pattern, $array) {
        for($x = 0; $x < count($array); $x++) {
            if(preg_match($pattern, $array[$x])) {
                return true;
            }
        }
      return false;
  }

  //Collect all css and place in an array
    $get_all_css = array();
    $get_all_css = drupal_get_css();

    //Put the return html styles in an array
    $ret_all_css = explode("\n", $get_all_css);
    //Get the array index of the matched in the search
    //$lookup_css = array_search('<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?G" />', $ret_all_css);
    $lookup_css = array_search_regex("/<link type=\"text\/css\" rel=\"stylesheet\" media=\"all\" href=\"\/modules\/node\/node.css\?.\" \/>/", $ret_all_css);

    //Unset the searched styles.
    unset($ret_all_css[$lookup_css]);

    //Return all essential styles. This should replace $styles in page.tpl.php
    $styles = implode("\n", $ret_all_css);


texts: Wrap a field in a link conditionally in views

texts:
I'm quite new to Drupal but I've been a developer for a few years. I'm struggling with what should be a very simple task. I have created a field 'field_client_link' that authors can use to enter a url to a portfolio content type about a client. If an author has entered a link I want to wrap a client logo in it, otherwise just display the image. I'm sure this is not as hard as I'm making it out to be. In WordPress I would just write something like this and be done with it:

<?php

    if (get_field('link')) {
        echo '' . get_field('image') . '';
    } else {
        echo get_field('image');
    }

?>

Here are my settings. I've set the link to be hidden because I don't want it outputting until I call it later. Hoping you can help me:


texts: How can I read uploaded CSV file data and create nodes from it?

texts:
I have created custom module. but don't know how to read uploaded file data and add into perticular content type. HTML File upload is displayed but after upload file unable to read content.

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

    $items['custom_add_node_data/add_data'] = array(
        'title'             =>  '',  //page title
        'description'       =>  '',  //description show when mouse hover on link
        'page callback'     =>  'upload_file_form',  //callback function which is invoked when menu item is called.
        'access callback'   =>  true,  //any user can access this page
       );
     return $items;
}

Below are the callback functions:

function upload_file_form($form, &$form_state){
  $form=array();

   $form['upload'] = array(
        '#type' => 'file',
        '#name' => 'custom_content_csv_file',
    );

    $form['submit_button'] = array(
        '#type' => 'submit',
        '#value' => t('Upload'),
    );

   return $form;

}

function upload_file_form_submit($form, &$form_state) {
 $file = file_save_upload('upload', array(
        'file_validate_extensions' => array('txt'),
    ));

    //get the content in the file
    $content = file_get_contents($file->uri);
var_dump($content);
    //remove the file in temp and the pointer in the database
    file_delete($file);

    //remove the file in temp and the pointer in the database
    //file_delete($file);
}


texts:
I want to make a profile for musicians. They should type their skills (reference to taxonomy) and levels (radiobuttons) like flute - beginner, piano - advanced,...
Then I need a view with the profile information and the skills and levels. There should be a possibility to search for the skills and levels.
I tried it with a field collection field in the profile but then there is only one exposed filter for the profile field, a textfield for both the skills and levels.
How can I do this? I am getting mad about it. Is there another way to make this work?


texts: How to allow anonymous users to view page?

texts:
I would like to make a new page, before publishing it I'd like to send it to other people to review/approve the content without having to log in.

Is this possible?


texts: User email being deleted when submitting Profile 2 form

texts:
i'm debugging a site that I haven't made.  The issue is that the users email address is being deleted.

I've found which form it's happening on; and by using hook_form_FORM_ID_alter I can see that $form has this information at before sending and not after it's been sent.

I've written a patch that writes it back in but my question is what the best way is to backtrace where the bug actually is.  I'm using phpstorm as my IDE and have put breakpoints in modules I think could be at fault but without joy.

Any other tips on this one ?

Much appreciated.


texts:
I added for users a couple of fields : field_telephonenumber and field_company

how can i display them in user.html.twig or maybe page.html.twig


texts: How to manually uninstall/purge modules?

texts:
I have a module Media: YouTube which is being buggy when attempting to uninstall. I disabled it in the modules along with its dependencies, and when I go to the uninstall tab and perform the uninstall operation, it returns a blank screen. I go back to the module page, and it's still there (along with 3 other modules that need this one uninstalled first before the others can be removed).

Is there a general method of purging modules from the backend? I have full access to the server and database as well.

EDIT: Checked logs and found a PHP error:

  [Thu Jan 19 13:12:21 2012] [error] [client 192.168.xxx.xxx] PHP Fatal
  error:  Call to undefined function media_youtube_variable_default() in
  /var/www/drupal/sites/all/modules/media_youtube/media_youtube.install
  on line 19, referer:
  http://vulcan/drupal/?q=admin/modules/uninstall/confirm&render=overlay

Sounds like it's just a badly written module?


texts: POST regular JSON to custom RestResource

texts:
So I created my own RestResource, like so:

/**
 * Provides a resource to get/create content data.
 *
 * @RestResource(
 *   id = "mycontent_content",
 *   label = @Translation("My content"),
 *   uri_paths = {
 *     "canonical" = "/api/content/{type}",
 *     "https://www.drupal.org/link-relations/create" = "/api/content/{type}"
 *   }
 * )
 */
class ContentResource extends ResourceBase {

    public function get($type) {
        // Works
    }

    public function post($type) {
        // Doesn't work
    }
}

GET works fine, but I can not post a regular JSON object.

With the content-type set to application/json I always get this error:

{
    "error": "Could not denormalize object of type , no supporting normalizer found."
}

I guess it's trying to create an entity out of it, but that's not what it is. I just want the damn JSON object as it is.

Is there some way to do this?


texts: How can I debug/test my custom migrate module?

texts:
I've written a custom migrate module in Drupal 8. (Based on these instructions: https://github.com/wunderkraut/migrate_source_example/)

The migration reads data from a XML file with the "migrate_source_xml" extension and should write/update the data in a node.

I have a yml config file in /config/install/ and some logic in /src/migrate/source/

When I run the migration with "drush mi --all" I get the correct values in my prepareRow function. Unfortunately, no nodes were create and I get the message "Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored)"

With the prepareRow function I'm able to stop the script at this position. But how can I debug the script afterwards? Does exist a postImport function or something similar?

How do you test your D8 migrations?

Thank you very much for your inputs!


texts:
I am using hook_views_query_filter to append my own where clause condition with the where clause of the query generated by the view.

So for this I am using this hook.

Here is my code

   function mymodule_views_query_filter(&$view, $query) {
 if($view->name = "myview") {
 $query->where[1] = array(
            'clauses' => array(
                            '0'=>"field_test_value=0",

                             ),
            'args' => array('0' => 'test1', '1' => 'test2'),
            'type' => 'OR',
            );
}
print_r($query);
}

So the where clause becomes like this after print_r() funtion.

[where] =&gt; Array
    (
        [0] =&gt; Array
            (
                [clauses] =&gt; Array
                    (
                        [0] =&gt; node.type in ('%s')
                        [1] =&gt; node.status &lt;&gt; 0
                        [2] =&gt; term_data.name = '%s'
                        [3] =&gt; term_data_term_node__term_data.name = '%s'
                    )

                [args] =&gt; Array
                    (
                        [0] =&gt; test1
                        [1] =&gt; test2l
                        [2] =&gt; test3
                    )

                [type] =&gt; AND
            )

        [1] =&gt; Array
            (
                [clauses] =&gt; Array
                    (
                        [0] =&gt; field_test_value=0
                    )

                [args] =&gt; Array
                    (
                        [0] =&gt; test1
                        [1] =&gt; test2
                    )

                [type] =&gt; OR
            )

    )

Where the 0 index of the where clause is coming from the view query and the 1 index of the where is clause is coming from my code.
But it only executes the 1 index of the where clause and display the results only if Where field_test_value=1 and I want something like this.

Where (node.type in ('%s') AND node.status <> 0 AND term_data.name = '%s' AND term_data_term_node__term_data.name = '%s') OR field_test_value=0


texts: Copy data from a selected view in a fieldcollection field

texts:
I have content_type TYPE1 content with two fields:

fiedl_1 is a viewfield type that allows me to display a view inside a node.
fiedl_2 is fieldcollection type.

Is it possible to copy the rows resulting from the view into my fielcollection?

Thanks a lot


texts: list of supported value in entity baseFieldDefinitions setDisplayOptions type(field widget)

texts:
I'm new in Drupal, I create my first entity and use baseFieldDefinitions to set fields and in fields I use setDisplayOptions to set form like this:

$fields['piece'] = BaseFieldDefinition::create('integer')
  ->setLabel(t('piece'))
  ->setDisplayOptions('view', [
    'label' => 'hidden',
    'type' => 'string',
    'weight' => 2,
  ])
  ->setDisplayOptions('form', [
    'label' => 'inline',
    'type' => 'string',/////// what is supported value list of type key
    'weight' => 2,
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

what is supported value list of type key in display option?

I only found options_buttons and string


texts:
I have a business case need to add a linked content type or table to a user's profile.  Basically, when they register an account, we want to know the make, model, and year of any recreational vehicles that they own.  I would like them to be able to enter as many vehicles as they currently own, each on their own row.  We will eventually be reporting on this data.  The make, model and year will be drawn from taxonomies, and the table or content type would basically consist of UID, Make, Model, Year.

I'm still relatively new to some of the more advanced features of Drupal, how would I accomplish this?


texts:
I am using the following code, but it doesn't work.

drupal_block.module

function custom_blocks_theme($existing, $type, $theme, $path) {
  return [
    'custom_blocks__front_apps' => [
      'variables' => [
        'app' => NULL
      ],
    ],
  ];
}

BlockTest.php

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#theme' => 'custom_blocks__front_apps',
      '#app' => 'test value',
    ];
  }

custom_blocks__front_apps.html.twig

Hello: {{ app }}

My block is empty.

What is wrong with the code?


texts: We created a custom Views block that shows a user's uploaded photos in a grid. Drupal has the draggable feature and users can edit the order of these images. However, I cannot see the sort by weight option. I know I can add it via Relationships but I don't see it there neither.


texts:
I want to show yesterday's posts on a block with views. So I added two date filters. They should be:

<today midnight

>yesterday midnight

(-1 day is not ok for me because it spans exactly 24 hours back)

According to the manual: http://php.net/manual/en/datetime.formats.relative.php
I added the two filters as:
Less than "today" (I also tried less than "midnight" or "today 00:00")
Greater than "yesterday" (I also tried greater than "yesterday 00:00")

But they are all showing the items from yesterday and today together.

Is there a way to show items from yesterday 00:00 to yesterday 23:59 ?


texts: Drupal Commerce "let me know when the price goes down"

texts:
I've been trying to create a price alert for products of which price dropped (let users flag that product and e-mail them when that product's price drops). For this purpose, I installed Flag and have been trying to make such a thing with it and Rules. Am I on the right track? If not, what can I do?

Regards,


texts: How to set the value of a field when hidden from certain users/roles?

texts:
I have a field which I don't want to be displayed for certain users, however I still want a value to be entered for that field, which is extrapolated from other fields they enter data in.

In order to do this, I'm setting the field as hidden in hook_form_alter:

$form['field_target']['#type'] = 'hidden';

and then setting the value of the field from within a form_validate function based on another field, such as:

$form_state['values']['field_target']['und']['0'] =
    $form_state['values']['field_source']['und']['0'];

And this works fine, unless I force a form validation error on field_source. When I correct the validation error and submit again, I get a white screen with PHP Error:

PHP Fatal error:  Cannot create references to/from string offsets
    nor overloaded objects in includes/common.inc on line 6288

This error happens even if I comment out the setting of field_target. However I can fix this error by removing the [#type'] = 'hidden' line and everything works fine, except that the field shows for all users.

Is there any way to fix my above approach, or is there a better way to achieve what I'm trying to do?


texts: How to record a log message when saving a Commerce Order via Drupal EntityWrapper?

texts:
I'm modifying a set of orders programmatically and want to record a log message when doing so.

Is there an existing method to add a revision and log when doing so?

$order_id = 800;
$order = commerce_order_load($order_id);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$order_wrapper->uid->set(1);
$order_wrapper->mail->set('test@example.com');
// $order_wrapper->log->set('Changed order owner and mail');
// $order_wrapper->revision->set(true);
$order_wrapper->save();

Currently if I try $order_wrapper->log->set('x'); I see EntityMetadataWrapperException: Unknown data property log., but I believe this is a property of the order (based on getPropertyInfo() etc).

Does Commerce Order + Entity Metadata Wrappers have support for creating a new revision on save, or recording an order log message?


texts: Select nodes that share some of the same tags, and sort by tags in common count

texts:
I have nodes that can have many tags.
I'm able to display nodes that share some of the tags.
        $query = \Drupal::entityQuery('node');

        if ($nodeId != null) {
            $query->condition('nid', $nodeId, '<>');
        }
        $query->condition('field_tags', $tagsIds, 'IN');
        $query->condition('status', 1);

That works. But now I'd like to sort them by relevance. In other words, the ones that have the most tags in common should come first.
Any idea how I can achieve that?
Thanks!